SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict TegSkywalker's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help uploading JPEGs via web form

    Ok here is my scenario.. I have a webform on my page that when the user clicks the Browse button, it lets them choose the file on their hard drive and gets uploaded to the webserver. After that, I check the files on the FTP and they uploaded successfully.

    Here is my problem.. text files and other ASCII related files upload fine. But whenever i click on a link to one of my uploaded JPEG images, it shows up in IE as red box (aka not being there) when actually it was uploaded via the web form. I think it may be something where the web form is uploading in ASCII format instead of also doing it in BINARY which is of course what JPEGs and GIFs need to be uploaded as.


    Here is the contents of my upload form page which of course has the ENCTYPE set to the proper one for file uploads:

    <form method="post" action="fileupload.php" enctype="multipart/form-data">
    <input type="file" name="userfile" value="Browse For File">
    <input type="submit" value="Submit" name="Submit">


    Does anybody know if there is any "input type" variables or other form related fields where I can force it to upload in BINARY format?

    This is one of those things that is ticking me off

    Thanks for the help if ya know.

  2. #2
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try taking the value out of the file input tag.

    Also, show us the code your using to copy the image to your server.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  3. #3
    SitePoint Guru DenverDave's Avatar
    Join Date
    Feb 2001
    Location
    Denver, Colorado
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Once you solve this problem, typically the image selected by the user may not be appropriate to place on the web site - wrong dimensions or too large a file size ( 3 mb attempts are not uncommon). I can stop a big file once it is uploaded, but I don't know how to do it before. Usually, I have to get envolved anyway.


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
  •