You are here:

PHP5/uploading images in PHP

Advertisement


Question
Hi,

Newbie here.  Very new to programming.  

What I am trying to do is upload an image from my desktop, to my server, and have it displayed on a webpage.  I'm doing this in PHP.

Here's the page I built to upload the image:
www.streettheory.com/save2web.php

When the image is uploaded, it should be:

1. added into server directory folder (sorry, not too sure if my technical terms are correct)

2. It should be displayed on this page (which I also built in PHP):

http://www.streettheory.com/

I'm not sure where my code on the save2web/php script is wrong, but I get an error on the page when I try to upload a pic saying:

Upload: image_of_kitchen.jpg
Type: image/jpeg
Size: 19.01953125Kb
Temp file: /tmp/php8abUQ7

Fatal error: Call to undefined function move_upload_file() in /home/content/03/9499003/html/save2web.php on line 32

*****
Not sure what I'm doing wrong.  

Also, I'm not sure in the script exactly how the webpage knows to place it on the www.streettheory.com index page.

Any ideas?

Mike

Answer
I can't troubleshoot much without seeing the code, but I can tell you what that error means.

Somewhere in your upload script, you're calling move_upload_file() on the uploaded file and PHP is basically telling you that the function move_upload_file() doesn't exist. This is because the function is actually called move_uploaded_file()

Make that change and see if it fixes your problem, and if not, paste your code here or on pastebin so that I can have a look.

Good luck!

Kevin Cackler
Tech Daddies, LLC
Russellville, AR Website Development

PHP5

All Answers


Answers by Expert:


Ask Experts

Volunteer


Kevin Cackler

Expertise

Any and everything related to PHP4 and PHP5. I specialize in functional, readable, scalable object oriented code, and can answer your troublesome class and object questions.

Experience

5 years developing in PHP using flat files and databases (MySQL, Oracle) Lead PHP developer for a very large Texas based web hosting company The coder behind some of the largest pet communities online.

Education/Credentials
BS - IT/CS

©2016 About.com. All rights reserved.