Page 1 of 1

Uploading files

Posted: Fri Feb 09, 2007 12:53 pm
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.

Posted: Fri Feb 09, 2007 3:41 pm
by louie35
can you post the code to see what you are doing?

without that how can we help.

Posted: Fri Feb 09, 2007 4:27 pm
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]