Page 1 of 1

Running php from html

Posted: Wed Nov 26, 2008 12:48 pm
by alexarsh
Hi,

I am pretty new to php. To be honest, this is my first experience.
I want to upload 2 photos to my web page. I have made 2 scripts for the server side:
html with browse buttons and submit and php file that should upload the photos.

The problem is that when I run "php uploader.php" locally on my computer it prints that it can not find the file to upload as expected,
but when I click the submit button from html, it prints the part of uploader.php content. I can't understand why. :cry:

Can anybody help, please?

Re: Running php from html

Posted: Wed Nov 26, 2008 1:00 pm
by JAB Creations
First do some reading here...
http://us3.php.net/features.file-upload

What is initially confusing though eventually very useful is that if you do not move the file using PHP after it has been uploaded then PHP will simply delete the file.

I learned this working on a function to validate uploaded images for avatars in regards to file size and image dimensions.

Hopefully that will adjust your attention to looking at related functions, good luck! :wink:

Re: Running php from html

Posted: Wed Nov 26, 2008 1:09 pm
by alexarsh
Thanks for the fast reply. This is exactly the way I did it and I still have the problem.
Any other ideas? I sure it's something very small that I'm missing.

Re: Running php from html

Posted: Wed Nov 26, 2008 1:13 pm
by JAB Creations
Did you switch the OS from/to *nix/Windows? If so PHP has to handle file paths differently.

Re: Running php from html

Posted: Wed Nov 26, 2008 1:23 pm
by alexarsh
I am using OS X.

Re: Running php from html

Posted: Wed Nov 26, 2008 1:30 pm
by JAB Creations
Nothing happens beyond this point until you post code explaining exactly what you have already attempted. Since you're doing this on OS X I'm not going to be able to make the most effective OS related suggestions though I am not altogether unfamiliar with the OS.

Re: Running php from html

Posted: Wed Nov 26, 2008 1:35 pm
by alexarsh
ok. Thanks anyway :D