12-08-2009, 07:38 AM
I want to keep it simple (file names :-)
How can I let an uploaded file overwrite an existing file that has the same name?
I was able to comment out the code in the upload processor file that creates a unique filename for the uploaded file, but I get a server error if that file name already exists.
I want to keep it really simple so the files can be named ID1.jpg, ID2.jpg etc.
12-19-2009, 03:21 AM
Newbie here - where would the above go or replace in the multiple.upload.processor.php?
Originally Posted by bokeh
This line is giving me two errors:
Originally Posted by knightman
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in ... multiple.upload.processor.php on line 92
Awesome script, btw. Regarding thumbnails I am just using phpThumb.
Parse error: syntax error, unexpected T_STRING in ... multiple.upload.processor.php on line 92
12-27-2009, 07:58 AM
Hello, thanks for multiuploader. But I need some help. I want upload into 2 directories.
So file1 in directory1 and file2 in directory2.. Is it possible? Thanks
01-04-2010, 10:12 AM
i am testing the multiple image uploader and i getting the following error:
thanks for your help!
An error has occured: : ... The upload form is reloading
03-25-2010, 07:42 PM
Hi guys, ive looked all over and followed some peoples suggestions but i cannot get these scripts to work.
Every time i attempt to upload images, i get the 'insufficient permission' error.
Using filezilla i have set the 'uploaded_files' directory to '777'.
I really have know idea how to solve this as the code clearly works for others.
Any help whatsoever will be much appreciated.
Thanks in advance
06-23-2010, 10:59 PM
I don't know if this thread is still supported but I have a question regarding MULTIPLE image uploads.
I would like people to upload two images (Husband and Wife).
I have two columns in my MySQL database (husband, wife)
What code do I used to store both file paths to the images in their proper places in the database?
06-24-2010, 12:50 AM
Nevermind, I just solved the coding problem by myself (YUSS!!)
If I want these images to expire after a year, is there some way to automatically delete these files out of my images folder?
I can image after a few years that the folder would just get too huge if nothing got deleted.
06-24-2010, 04:07 AM
Save the upload date in your DB and every so often delete the ones older than a certain age. Could be set up as a cron job.
06-24-2010, 03:04 PM
Originally Posted by bokeh
Awesome, so I can set up a cron job to delete the image itself in my "images" folder?
Do you know how to set this up? I know how to delete things out of the database but I don't know how to set up a program to delete actual files in a folder.
06-25-2010, 06:43 AM
I've got problems with a pre-existing upload form, its quite a long thing so I posted it elsewhere:
If someone could help me I'd really appriciate it, it seems like it should upload fine but it just... doesnt.
07-06-2011, 12:10 PM
I realize the last post on this thread is a year ago but it still comes up high on the list of Google searches for multiple file uploads. I tested the code and it works great(in fact the best I found), but I need to add the names of the uploads to a database. I read through the whole thread and saw the addendum that allows for this but it seems to add each image as a separate record. I want to add up to 8 images to a single record (along with other info). Arrays always give me headaches! I can't figure out where or how to add to the code. I need to add the images to fields image1, image2, image3 etc. Any help greatly appreciated!
07-06-2011, 04:18 PM
You need to post some code so you can be helped.
07-07-2011, 12:03 PM
OK, this is the form:
I added the following to the original code on the processor page
// filename: multiple.upload.form.php
// first let's set some variables
// make a note of the current working directory relative to root.
$directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
// make a note of the location of the upload handler
$uploadHandler = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'multiple.upload.processor.php';
// set a max file size for the html upload form
$max_file_size = 300000; // size in bytes
// now echo the html page
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<form id="Upload" action="<?php echo $uploadHandler ?>" enctype="multipart/form-data" method="post">
<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>"></p>
<input type="text" name="location">
<input type="text" name="description">
<p><label for="image1">File to upload:</label>
<input id="image1" type="file" name="file">
<p><label for="image2">File to upload:</label>
<input id="image2" type="file" name="file">
<p><label for="image3">File to upload:</label>
<input id="image3" type="file" name="file">
<label for="submit">Press to...</label>
<input id="submit" type="submit" name="submit" value="Upload us!">
What I get with the echo is
$q = "INSERT INTO properties ('location','description','image1','image2','image3') VALUES ('$location','$description',";
foreach($active_keys as $key)
$q .= "'$uploadFilename',";
$q .= ")";
[QUOTE]INSERT INTO properties ('location','description','image1','image2','image3') VALUES ('Main Street','2 unit townhouse','Array','Array','Array',)[QUOTE]
So 2 problems:
1. how do I get the actual name of the file and
2. how do I get rid of the final comma in the query.
07-07-2011, 12:06 PM
I should add that immediately before the code I added is the following
which is where the $uploadFilename in my query came from.
// now let's move the file to its final location and allocate the new filename to it
or error('receiving directory insuffiecient permission', $uploadForm);
07-07-2011, 12:39 PM
OK I see part of my error now. So I replaced
in the query and I get the file name, including the whole path from c:
If I echo this
I get the simple names of the files without the path. Somehow I have to put each file name into a variable like $filename1, $filename2, etc. up to $filename8 and add it to the query. The problem is I don't know how to build an array to do that. Also, the user may not upload 8 files so I'll get an error in my query if there are fewer images. I've been struggling with this for days now, so if anyone can help you'll save me from pulling out my hair
foreach($active_keys as $key)
Last edited by Calagoure; 07-07-2011 at 01:19 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)