You are here: file upload to on the fly subdirectory « All PHP « IT news, forums, messages
file upload to on the fly subdirectory

Posted by John Edmunds on 04/24/06 20:41

Hello,

I am working on implementing the following multiple file upload script:

http://www.nexusportal.net/attachment.php?attachmentid=842&d=1119740338

Works great as is.

In its default format it uploads all files to the same predefined folder
"uploads".

What I would like to do is create a subfolder on the fly which corresponds
to a variable which was passed in the URL.

So, a viewer links to the file upload page like so:

http://www.mydomain.com/upload.php?userid=1234

and, once they hit the submit button, the script then creates the subfolder
"uploads/1234" (or whatever the userid variable may be) and puts the images
in there. In this way everything stays organized by individual userid.

If someone had the time to look at the files in that zip, or just give me a
nudge in the right general direction, I'd appreciate it greatly.

The zip contains a config.php file which defines the upload destination
thusly:

$uploadPath = '/home/pioc/mydomain-www/uploads';

and then in the actual upload.php page it is then used like this:

if ($uploadPath!=='') $moveToDir = $uploadPath;
else {
$domName = str_replace('www.','',$_SERVER['SERVER_NAME']);
$moveToDir = '/home/httpd/vhosts/'.$domName.'/httpdocs'.$dirName;
}

if (!file_exists($moveToDir)) die ('<div id="error"><h3>** CONFIGURATION
ERROR **</h3><p>Directory location does not exist:</p><p>'.$moveToDir.'</p>
</div></body></html>');
if (!is_writeable($moveToDir)) die ('<div id="error"><h3>** CONFIGURATION
ERROR **</h3><p>Permissions error (CHMOD).</p><p>Please set write
permissions to:<br />'.$moveToDir.'</p></div></body></html>');


Thanks very much.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация