PDA

View Full Version : uploading files via a webpage - can't get the path righ...


gymshoe
10-03-2000, 03:53 AM
I have a page where I can upload a file to the server.
Upon uploading the file is stored in some temp file.[nbsp][nbsp]I need to copy this file to some location. the syntax i have goes:
copy($filename, <path>);

the <path> is where the file will be copied to. But I can't seem to get the right path. It keeps saying
unable to create '<path>': No such file or directory in /big/dom/...etc.

My web stuff is under the www directory.
in there i have a gallery directory.
in the gallery directory, I have a sub-directory called custom
and under custom i have another sub-directory called rings.
what should the path to that location look like?
/www/xmydomain/gallery/custom/rings/[nbsp][nbsp]?
or
/gallery/custom/rings/[nbsp][nbsp]?
or ....what?[nbsp][nbsp]

any ideas would be greatly appreciated!
-james

Terra
10-03-2000, 04:19 AM
Which server are you on, and what is your domain name...

The PHP program you are trying to call is?

Once we have this information, I will have Justin take a closer look at it...

--
Terra
sysAdmin
FutureQuest

gymshoe
10-03-2000, 04:25 AM
okay...so i'm replying to my own post! =) hehe...
well...I've gotten it to now give me a permission denied error.

I even tried changing the permissions for the directory i want to copy the files into. I changed it so it had world write permissions.

any ideas?
-James

Shalazar
10-03-2000, 04:28 AM
Your full path should be something like:

/big/dom/xmydomain/www/gallery/custom/rings

In the meantime, why don't you just start with the full path, and then start chopping off one section at a time, and recording your successes or errors?

And if I recall correctly, since PHP runs as Apache rather than your user ID, you'll need to chmod any directories to which you're writing to 777.


[This message has been edited by Shalazar (edited 10-03-00@03:31 am)]

Justin
10-03-2000, 06:19 AM
Have you visited the PHP3 upload tutorial (http://www.aota.net/PHP_and_MySQL/phpupload.php3) yet? It deals with issues specific to our configuration. Note that the same tutorial also applies to PHP4, though I haven't yet updated the page (doing so now).

The main point to keep in mind is that PHP runs as user 'apache', as well as in SAFE_MODE. Thus, for PHP to be able to create a file within a directory, that directory must be writable by user 'apache' (others). IOW, set the permissions to 777 for the directory you are going to create files in (or move files to). Also note, it's a good idea to have this directory outside of your /www/ tree for security reasons.

------------------
Justin Nelson
FutureQuest (http://www.FutureQuest.net/index.php) Support

gymshoe
10-04-2000, 06:48 PM
yay!!!
Thanks Justin for pointing me to that reference.
It worked!
but just one last thing.
When I look at the files that I've uploaded, they all have an asterik at the end.[nbsp][nbsp]I've figured out that they're white spaces....but how'd they get there? I checked the file names I submit, and there are no spaces at the end...
they look like this..
mypicture.jpg*

strange....any ideas?

Thanks!
-James

Justin
10-04-2000, 07:31 PM
If you are refering to what you see when typing 'ls', you may want to view the man pages for ls (</font><font face="Courier" size="3">man ls</font><font face="Verdana, Arial" size="2">). A * is indicative that the file is marked executable. All this means is that the file permissions were set to where the file is marked executable. It shouldn't hurt anything, but it is best to make sure that file is not in your /www/ tree, as recommended previously.

------------------
Justin Nelson
FutureQuest (http://www.FutureQuest.net/index.php) Support