Re: Uploading files

From: Date: Tue, 20 Feb 2001 22:26:46 +0000
Subject: Re: Uploading files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40826@lists.php.net to get a copy of this message
I wouldnt worry about filenames :) just make your own file name, store that name with cross reference to the real filename in a db. I allow users to update images to our server, I store them directly in the db, I also store the mime-type along with the filename. every file has a unique file_id number, I set this with the time functiuon, spec microtime(). <?php include_once('database.egn'); include_once('time.egn'); if (isset($db_file)) { echo "INSERTING <br>\n"; $db_file = urlencode(fread(fopen($db_file, 'r'), filesize($db_file))); $db_file_id = mtime(); insert_db_value('images', " '$db_file_id', '$db_file', '$db_file_name', '$db_file_type' "); } echo " <html> <body> <form method=post enctype='multipart/form-data' action='$PHP_SELF'> <input type=file name=db_file> <input type=submit> </form> </body> </html> "; ?> something like this is real simple and works. might not be what your looking for but could be easily modified. -- Chris Lee Mediawaveonline.com em. lee@mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Ashley M. Kirchner"" <ashley@pcraft.com> wrote in message news:3A92D5AC.D12D0C02@pcraft.com... > > Before I embark on this little project, or just hunt for one already > written (anyone have suggestions?), when creating an Upload script, how > does one go about files coming from different platforms? > > We have a unix FTP server and we'd like to make an Upload function > on our website, where people can fill in a form with their information, > select their (local) file to be uploaded and submit it. However, I'm > somewhat at a loss when it comes to things like: > > - how to handle files with spaces in them? > - how to handle files created on a Mac platform, that include > characters like / , or a Mac-dot (OPTION-8), stuff that wouldn't > normally be allowed in a PC formatted file name > - how to handle Mac font files. Whenever we have clients email us > individual fonts, it never comes through because of the font > control file. We always get a 0 byte file. (might this be > because our mail server is also unix, and mac files are 7-bit, > versus PC/Unix being 8-bit?) > > I'm sure there are other issues to cope with, but these are the > immediate ones I can think off. Does anyone have a relatively robust > Upload function written, or one you'd recommend using? > > AMK4 > > -- > W | > | I haven't lost my mind; it's backed up on tape somewhere. > |____________________________________________________________________ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Ashley M. Kirchner <mailto:ashley@pcraft.com> . > 303.442.6410 x130 > SysAdmin / Websmith . 800.441.3873 x130 > Photo Craft Laboratories, Inc. . eFax 248.671.0909 > http://www.pcraft.com . 3550 > Arapahoe Ave #6 > .................. . . . . Boulder, CO 80303, USA > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#40826) next »