Uploading files

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
negvillamizar
Forum Newbie
Posts: 3
Joined: Mon Aug 28, 2006 1:01 pm

Uploading files

Post by negvillamizar »

Hi everyone.

I am having a bit of a problem, and I was wondering if some one can help me. I am running PHP, Apache and MySQL on an XP Professional PC, and I am trying to write some code to be able to upload pictures to my site. I have not be able to set the permissions to get the files moved from the temp upload folder to the location I want to put them.

Also, something odd is happening, If I do not specified a location to move the files, then it uses the root folder and move the files there, the wired thing is, that when I run the script the first time, it does not move the file and yet shows not errors or warnnings, but if I run it again, then it does move the file.

Does anyone have any ideas or guide lines ? I would really appreciate it.

Thanks.
User avatar
louie35
Forum Contributor
Posts: 144
Joined: Fri Jan 26, 2007 8:40 am
Location: Dublin
Contact:

Post by louie35 »

can you post the code to see what you are doing?

without that how can we help.
negvillamizar
Forum Newbie
Posts: 3
Joined: Mon Aug 28, 2006 1:01 pm

Post by negvillamizar »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi louie35, thanks for replying.  Here is the code.

Code: Select all

<?php

//Folder where the files will be uploaded  C:\Apache2.2\htdocs\movies\jpgs
                 
$uploaddir = "C:\Apache2.2\htdocs\movies\jpgs"; 
$uploaddir.= $_FILES['jpgfile']['name'];

if(is_uploaded_file($_FILES['jpgfile']['tmp_name'])){
	if (move_uploaded_file($_FILES['jpgfile']['tmp_name'], $_FILES['jpgfile']['name'])){         //$uploaddir)){
		echo "file updoladed";
	}
	//header("Location: NewMovieWzrd3.php?jpg=1");
}
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply