Yes, that is right, with javascript the files must be sent to the server side in order to be managed. The reason is that javascript cannot interact with the user filesystem, because of security reasons. If this would be possible, some malicious programmer could easily access every user filesystem, what could become terrible.
And that is the reason because the browsers don't have that technologies by default. If a user wish to install them, it is their responsibility.
Yes, that is right, with javascript the files must be sent to the server side in order to be managed. The reason is that javascript cannot interact with the user filesystem, because of security reasons. If this would be possible, some malicious programmer could easily access every user filesystem, what could become terrible.
And that is the reason because the browsers don't have that technologies by default. If a user wish to install them, it is their responsibility.
I agree that Javascript cannot interact with the filesystem. I was saying your blanket statement that Javascript cannot manipulate individual POST elements was misleading and didn't want others to be confused.
than, I'm not realy confident with JS. I understand the way the script is running but I really don't get how to do it with more uploads.
You reffer to the Iframe uploadedImage to show the preview but how can I upload more files and show all previews to the client??
Reading this treath from A to Z, I saw you give the solution for the multiple uploads.
So I downloaded the two zip and try it.
It works fine just tne naming of the saved file give me some troubles. How can i make it to give a specific name, based on the client name and a number?
Thanks for the great plugin. This is exactly what I am looking for. Btw I have try to modify the code to enable 3 type of images resize but am having some problem in doing it. Could any pls help me on this?
Btw I have try to modify the code to enable 3 type of images resize but am having some problem in doing it. Could any pls help me on this?
Hi Fire,
I'm afraid I haven't understood the issue correctly. But if what you want is to give the possibility of selecting a resizing dimension, you should do it in html, and then pass the value to php.
This value should be used instead of "maxImageDimension", in the uploadImage.php file, in the statement:
Thanks for the fast reply. Actually I am thinking of creating more images size, currently your plugin only created 2 type of size that is the 'Thumbnail' and the 'Medium' size. How could I do so if I need to create another size? That mean a total of 3 sizes 'Thumbnail', 'Medium' and 'Large'?
For your information, I have modify some of your code and successfully generated the 3 type size in the temporary folder but the 'Large' size just failed to be moved from the temp folder to the 'Large' folder when I save it. Pls refer to the 'function moveTempFileDescriptiveName' which I have modified as below.
public static function moveTempFileDescriptiveName($tempFilename, $keywords) {
// if the file already exists in the target path, it must be deleted
// or there will be an error when moving a file with the same name.
// Ideally, all the names are unique, and no file will be moved with
// the same name as another that already is there
unlink($targetFilePathname);
}
if ( ! rename($tempFilePathname, $targetFilePathname)) {
$probablyUniqueFilename = null;
}
elseif (file_exists($targetFilePathname1)){{
// read comment above for deleting the existing file
unlink($targetFilePathname1);
}
if ( ! rename($tempFilePathname1, $targetFilePathname1)) {
$probablyUniqueFilename = null;
}
}
How can I change the $uploadFilenames name from the current one that using the 'Keyword' to something like
$uploadFilenames = microtime(true) . $sessionid; or something like
hash_file('sha256', $filePath)
We are actually working on an uploading site that we need to make sure all of the images file name stored in the folder must be unique to each other.
A unique filename is generate by the function uploadedFile.php > getDescriptiveUniqueFilename(). A filename is generated with the given keywords. Three of these keywords are randomly taken, and, if the filename already exists, a unique filename is generated with the temp filename that php generated to upload the file. The code is at the end of the named function:
It is 99% secure, but if you want to improve the algorithm, the getDescriptiveUniqueFilename() function is the place.
Originally Posted by SpitFire11
The last question would be how could I store the path for each of the uploaded and saved images to the mysql database.
The insert.php script calls to UploadedFile::moveTempFilesDescriptiveNames() and stores the uploaded paths in the $savedImages array. You could then pass that array to a function that inserts the paths into a database.
I did search for the syntax to pass the the $savedImages array to a function as per mentioned but I just couldn't find it. Could you help to show me a simple syntax to pass the array to a function.
Thanks again and sorry for my ignorance.
The insert.php script calls to UploadedFile::moveTempFilesDescriptiveNames() and stores the uploaded paths in the $savedImages array. You could then pass that array to a function that inserts the paths into a database.
Bookmarks