Problem uploading files

Discussion in 'General troubleshooting' started by JohnGrieb, Jan 22, 2014.

  1. I am having problems uploading files using the jquery plug-in Uploadifive on my hosted site (it works fine on my dev box).
    The client side is working fine.
    This is the code I'm using to detect the file on the server:

    HttpFileCollectionBase files = Request.Files;
    for (var i = 0; i < files.Count; i++)
    {
    HttpPostedFileWrapper file = (HttpPostedFileWrapper) files [ i ];

    if ((file != null) && !string.IsNullOrEmpty(file.FileName))
    {


    When the post gets to the server, I can detect that a file was uploaded but the filename is blank and the content-length is 0.
    The mime type is correct: application/octet-stream.
     
  2. Have you set the enctype?

    enctype="multipart/form-data"

    I don't know if that's the cause of your problem, but it's commonly overlooked when uploading files and can cause the empty file on the server.

    Also, I trust you're doing some kind of file validation or checking, since file uploaders are a common cause of site compromise.
     
  3. Yes I set the "enctype" to "multipart/form-data".

    Yes I'm doing file validation.
     

Share This Page