Skip to main content
Participant
December 17, 2009
Question

File upload Issue

  • December 17, 2009
  • 1 reply
  • 1121 views

While uploading file with file name having maximum length

ex:- 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.jpg

using coldfusion, uploaded file in server gets corrupted

I am using cf8 and windows xp

code set is given below

---------------------------------------------------------------------------

<form action="" method="post" enctype="multipart/form-data">
    <input type="file" name="img">
    <input type="submit" name="submit" value="submit">
</form

<cfif ISDefined('Form.img')>
    <cffile
        action="upload"
        destination="D:\thumb"
        filefield="img"
        nameconflict="makeunique"/>

    <cfdump var="#cffile#">
   
    <cfdump var="#len(cffile.CLIENTFILE)#">
</cfif>
------------------------------------------------------------------------

Please help?

    This topic has been closed for replies.

    1 reply

    Inspiring
    December 17, 2009

    The file gets corrupted, or you have a problem with the nfile path being too long?

    On Windows the restriction is on the entire file path, not simply the file name.  The file path cannot be more than 260 chars (incl. drive letter and colon and all the slashes).  The dir can be a max of... ooh... I think it's 255 chars.

    So ber in mind when you upload this file to the server, the file needs to be put in a directory.  If the file name and the directory if goes in to will be longer than 260 chars, the web server is going to have to do something about that (which could be error, or it could be to truncate the file name, dunno).

    --

    Adam

    sujeeshdlAuthor
    Participant
    December 17, 2009


    Hi Adam,

    Is there any work around for this?

    Inspiring
    December 17, 2009

    Work aorund for a limitation of the Windows file system?  No.  Well: you could port to *nix I guess ;-)

    But you didn't answer my question.  You said it's corrupting the file.  I find this hard to believe.  I've not experimented with this, but I suspect all that's going on is that it's altering the file name.  And it's not a corruption, it's just an adjustment so that it's actually possible to save the file.

    Can you please clarify exactly what the problem is you're seeing?

    --

    Adam