Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

PHP file upload problem


  • Please log in to reply
4 replies to this topic

#1 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:09:06 PM

Posted 12 February 2010 - 08:25 AM

Hi,
I wanted to make an admin page on my site so I can upload images using web admin interface and so that I don't have to go through FTP upload. Here is my stripped down code for uploading :

<form enctype="multipart/form-data" action="index.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Upload : <input name="picture" type="file" /><br />
<input type="submit" value="Upload" />
</form>

But the thing is that it does not work when I click Upload button. The $_POST and $_FILES variables are empty. I checked by using print_r($_POST) and print_r($_FILES). The result is that it prints only Array()

I Googled and found many people facing this problem but could not find any solution. I tested on WAMP on Windows Vista, then tested on Ubuntu but nothing works.

Please suggest me some solutions or other methods of uploading a file through web interface.
Thanks.

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:06 PM

Posted 12 February 2010 - 10:48 AM

What is the name of the file that is supposed to be getting the image? Is it really index.php?

#3 Romeo29

Romeo29

    Learning To Bleep

  • Topic Starter

  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:09:06 PM

Posted 12 February 2010 - 12:11 PM

Yes. I was testing on local server with that file name. I would change it to something else when uploading to actual web host.

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:06 PM

Posted 12 February 2010 - 12:22 PM

Without seeing all of our code, I can't say for sure. My forms for file uploads are just like that, except I am using AJAX to do the uploads. All I could guess is that you have a syntax error somewhere.

EDIT: I lied (well, sort of). I am using the same form, but I am using a control from the YUI library that is handling the actual upload.

#5 Romeo29

Romeo29

    Learning To Bleep

  • Topic Starter

  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:09:06 PM

Posted 12 February 2010 - 03:03 PM

Thanks groovicus for hinting at YUI library, its amazing :thumbsup:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users