Download files from folder in webmatrix - webmatrix

I have a "ticket system" and when the user creates a ticket there is an option to upload files. Those files go to a folder that have the name of the ticket.
This is the code that creates the folder when the ticket is created.
var nomePasta = "Ticket Id - " + idNovoPedido;
string salva = Path.Combine(Server.MapPath("~/"),"uploadedFiles",nomePasta);
Directory.CreateDirectory(salva);
Then on the backoffice i can see if there are any files on that folder.
Code to check if there are any files:
#foreach (string fullFilePath in Directory.GetFiles(Path.Combine(Server.MapPath("~/uploadedFiles"),"Ticket Id - "+#id)))
{
<div class="linkFicheiros">
#Path.GetFileName(fullFilePath)
</div>
}
Now my question is, how can i download the files?
If i click on a link (example if it's a photo, my browser opens a new window and show me the image) and if it's a "docx" it says that "The page cannot be found."
Update:
So i've found something, if the file is ".xls" i can download it without any problem, but if the file is ".docx" it gives the error mentioned above "The page cannot be found.".
Any thoughts ?

There are other warnings in Internet for the same problem stating that it depends on the lack of definition on the web server for the DocX files' MIME type : Page cannot be found Error when executing a Hyperlink to a DocX File.
Anyway, if it could be useful, in this article I have used a universal routine for the file downloading: Downloading Files C#. You should add the .docx case and its MIME type:
application/vnd.openxmlformats-officedocument.wordprocessingml.document

Related

Getting error after upgrading the joomla site and admin end is blank page

After upgrading the joomla site iam getting the following error and administrator page is blank.
Fatal error: Can't use function return value in write context in /home/cll/public_html/libraries/regularlabs/src/File.php on line 283
Please help me to solve this issue.
It's clear that the problem comes from a regularlabs extension so you should disable it.
Since your admin page is blank, you can do this via the file system. Log in to your FTP account (or use the control panel's file manager) and access your root folder (/home/cll/public_html/). The extension you are looking for is probably a plugin so you'll find it in the plugins folder. I assume you'll find the extension in the /plugins/system/ folder (full path: /home/cll/public_html/plugins/system/).
When you'll find the extension's folder look for the plugin's PHP file and rename it.
For example, if the problem comes from "components anywhere" plugin (it's a regularlabs extension) search for componentsanywhere.php and rename it to something else (eg foobar.php).
If this doesn't help contact the developer to help you, he is a good guy.

error LGHT0311 while including License.rtf file in Wix Toolset Application

I am using WIX Toolset to create MSI Application and I want to provide my own License file to display during the license Agreement on License Agreement Dialog.
I created a new document in word-pad and saved it with .rtf extension. Whatever the content of document wix is not getting build and the error which comes is error LGHT0311.
C:\agent\_work\8\s\src\ext\UIExtension\wixlib\LicenseAgreementDlg.wxs(27,0): error LGHT0311: A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Product/#Codepage, Module/#Codepage, Patch/#Codepage, PatchCreation/#Codepage, or WixLocalization/#Codepage.
Note:- LicenseAgreementDlg.wxs(27,0) contains this line <Text SourceFile="!(wix.WixUILicenseRtf=$(var.licenseRtf))" />
I have tried adding Codepage value as 1252 in Product tag and SummaryCodepage in Package Tag. I have tried even by putting only one character in License file but still getting same error.
Please help me solving this issue?
You need to create your license with WordPad and save it with *.rtf extension.
I was creating the license with Microsoft Office Word, and then saving with *.rtf extension, which was giving error like above.

jQUery chosen which files to include for using it

i am new to chosen.js .i download release 1.0.0 . when i download it contains a lot of file .in which i think we have to include chosen.min.css and chosen.jquery.min.js in our html page.i am confirming my assumption is correct or not ?? or we have to include other files also in our html page to run chosen method properly ??

Can't download files from the downloadable products folder directly from the product page

I've created a few downloadable products and added an mp3 file as the product.
Now instead of going through the checkout to download the file i wanted the user to be able to do it on the products page in view.phtml by clicking on a link
The problem i have is that i can't seem to download files which are in this downloadable folder
media/downloadable/files/links/t/o/toast_to_the_dead_-_immortal_technique.mp3
If i move that track to media/filename.mp3 ..or even in the wysiwyg folder then i can download it using my script. I've checked the file permissions etc and they're fine so im stuck as to why i can't download my files.
Does anyone know? or is there a way i can change the folder from downloadable to something else, as all i need downloadable products for is music files.
Cheers
Edit:
I should also add that i am getting the download box to save the file, with the correct file name and path, its just the file is 523 bytes, im using the code below to get the filepath
$mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
$_linkpath = $mediaUrl."downloadable/files/links".$_link->getLinkFile();
If i were to change the link path to $mediaUrl."filename.mp3" etc then it would download..so seems to me that its the downloadable folder thats causing the problem?
Nevermind I've solved this, I just changed $_linkpath to
$_linkpath = "media/downloadable/files/links".$_link->getLinkFile();
The full url was causing the problem

How can I create a download link in octopress

I'm using Octopress for my blog and need to create a link to download a text file.
There is a built in plugin called include_code that renders a link but also shows the file. I just want the link. Does anyone know how I can do this?
Put your text file under source/downloads/code
Then you can use the markdown syntax for showing links like this :
[link name](url for the txt file)
The url will be {your blog url}/downloads/code/{name of txt file}
This is derived from the include_code plugin which also shows a download link for each code listing.
UPDATE :
To do it from within HTML, you can use
Text File

Resources