Running php from html

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alexarsh
Forum Newbie
Posts: 4
Joined: Tue Nov 25, 2008 9:14 am

Running php from html

Post 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?
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Running php from html

Post 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:
alexarsh
Forum Newbie
Posts: 4
Joined: Tue Nov 25, 2008 9:14 am

Re: Running php from html

Post 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.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Running php from html

Post by JAB Creations »

Did you switch the OS from/to *nix/Windows? If so PHP has to handle file paths differently.
alexarsh
Forum Newbie
Posts: 4
Joined: Tue Nov 25, 2008 9:14 am

Re: Running php from html

Post by alexarsh »

I am using OS X.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Running php from html

Post 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.
alexarsh
Forum Newbie
Posts: 4
Joined: Tue Nov 25, 2008 9:14 am

Re: Running php from html

Post by alexarsh »

ok. Thanks anyway :D
Post Reply