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.
Uploading files
Moderator: General Moderators
-
negvillamizar
- Forum Newbie
- Posts: 3
- Joined: Mon Aug 28, 2006 1:01 pm
feyd | Please use
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]