SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    uploading files in perl cgi using ascII mode

    hi I am having problems trying to upload file using perl cgi.

    I can upload the file from my wondows into my linux server using a perl cgi script, however the problem is I am transfering it in binary mode. Can anyone tell me how I can set it so that the transfer is doen using ascII mode. below is a code snippet I am currently using.

    the problem I have is when the upload is complete I am getting invalid carriage returns (^M) which is causing the file not to be recognised when I try to open it in a browser.

    $start_time=time();
    while ($bytes_read=read($filepath,$buff,2096))
    {
    $size += $bytes_read;
    binmode WFD;
    print WFD $buff;
    }


    any help would be much appreciated. Many thanks
    Shuel

  2. #2
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Problem solved.

    by using the followin command:

    system(`dos2unix <file>`);

    Regards
    Shuel


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •