GetDotted Domains

Viewing Thread:
"Uploading files using PHP move_uploaded_file problems"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Thu 29/01/09 at 15:17
Regular
Posts: 28
I have not been able to upload files using PHP. I have looked at some previous threads and modified a few things but still have no joy. The code lines below show what I am trying within a function called by a form posting userfile1 to it. I am quite new to this so I am expecting I am staring right through the problem. Any pointers most welcome.

When the function is run it just sits there for quite a long time and I have been unable to get any erro messages back,

$uploaddir = '/freeola/users/5/3/srnumber/htdocs';

$destination1 = $uploaddir."/Images/". $_POST['Registration']."-1.jpg";

if (move_uploaded_file ($_POST['userfile1'],$destination1)){};





Help!
Thu 29/01/09 at 23:27
Regular
Posts: 28
Hi Eccles,

Thanks for your post. I have actually sussed the problem and finally got everything working.

Problem was in front of me as you say using $_POST instead of $_FILES but it also was related to me uploading three files cruedly from a single form call where I need to unlink the first tmp_file before moving the next one and so on.

Anyway as I said. Thanks. All part of the learning experience.
Thu 29/01/09 at 22:35
Staff Moderator
"Aargh! Broken..."
Posts: 1,408
Hello,

The main problem you have is that you are using the wrong global array. PHP stores uploaded file data in the $_FILES array.

Firstly your HTML upload form tag should have
enctype="multipart/form-data" method="post"
see here and the action attribute should point to your PHP process script.
You should then be able to access the uploaded file to save it using the $_FILES array, see here.
PHP.net explains this fully but post back here if you are still stuck.
Thu 29/01/09 at 15:17
Regular
Posts: 28
I have not been able to upload files using PHP. I have looked at some previous threads and modified a few things but still have no joy. The code lines below show what I am trying within a function called by a form posting userfile1 to it. I am quite new to this so I am expecting I am staring right through the problem. Any pointers most welcome.

When the function is run it just sits there for quite a long time and I have been unable to get any erro messages back,

$uploaddir = '/freeola/users/5/3/srnumber/htdocs';

$destination1 = $uploaddir."/Images/". $_POST['Registration']."-1.jpg";

if (move_uploaded_file ($_POST['userfile1'],$destination1)){};





Help!

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Unrivalled services
Freeola has to be one of, if not the best, ISP around as the services they offer seem unrivalled.
Easy and free service!
I think it's fab that you provide an easy-to-follow service, and even better that it's free...!
Cerrie

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.