Rank: Newbie
Groups: Member
Joined: 11/4/2008(UTC) Posts: 4
|
Hi Fedor and thank you for the quick response. As it concerns point 3, i managed to overcome it by creating a unique file name on the server using the uniqid() function. as it concerns the point 1 it still doesnt work. I must be missing something. When I turn the iu.addParam("UploadSourceFile", "true"); parameter to false it will not upload anything....I am going to give you the code I am using both on the client side and on the server side just in case you can help me. Thank you. Client Side Code: Code:
<script language="javascript">
var iu = new ImageUploaderWriter("ImageUploader", 650, 450);
//Configure License Keys
iu.addParam("LicenseKey", "71050-4658A-00000-06E9E-EF280;72050-4658A-00000-0A73B-88BD2");
// If you do not want to use ActiveX or Java version, set the appropriate
// property to false.
iu.activeXControlEnabled = false;
iu.javaAppletEnabled = true;
iu.activeXControlCodeBase = "ImageUploader5.cab";
iu.javaAppletCodeBase="./";
//Configure appearance.
iu.addParam("PaneLayout", "TwoPanes");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("AllowRotate", "false");
iu.addParam("BackgroundColor", "#ccccff");
iu.addParam("FileMask", "*.jpg;*.jpeg;*.jpe;*.png");
iu.addParam("Charset", "UTF-8");
iu.addParam("UploadSourceFile", "false");
iu.addParam("MaxFileSize", "600000");
iu.addParam("MaxTotalFileSize", "2000000");
iu.addParam("MaxDescriptionTextLength", "100");
//Configure thumbnail settings.
iu.addParam("UploadThumbnail2FitMode", "Fit");
iu.addParam("UploadThumbnail2Width", "600");
iu.addParam("UploadThumbnail2Height", "460");
iu.addParam("UploadThumbnail2JpegQuality", "100");
//Configure thumbnail settings.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "120");
iu.addParam("UploadThumbnail1Height", "120");
iu.addParam("UploadThumbnail1JpegQuality", "100");
//Configure URL files are uploaded to.
iu.addParam("Action", "upload_src.php")
//Configure URL where to redirect after upload.
iu.addParam("RedirectUrl", "uploader.php")
iu.writeHtml();
</script>
Server Side Code: Code:
<?php
//This variable specifies relative path to the folder, where the gallery
//with uploaded files is located.
$galleryPath = "images/img/";
$absGalleryPath = realpath($galleryPath) . "/";
//Get total number of uploaded files (all files are uploaded in a single package).
$fileCount = $_POST ["FileCount"];
//Iterate through uploaded data and save the original file and thumbnail.
for ($i = 1; $i <= $fileCount; $i++)
{
//Get source file and save it to disk.
$sourceFileField = "SourceFile_" . $i;
$mime_image = $_FILES[$sourceFileField]['type'];
//generate a unique filename
$unique_name = uniqid();
switch ($mime_image){
case "image/gif" :
$file_name = $unique_name . ".gif";
break;
case "image/jpeg" :
$file_name = $unique_name . ".jpg";
break;
case "image/pjpeg" :
$file_name = $unique_name . ".jpg";
break;
case "image/png" :
$file_name =$unique_name . ".png";
break;
} // end switch generate a unique filename
move_uploaded_file($_FILES[$sourceFileField]["tmp_name"],
$absGalleryPath . "/" . $file_name);
//Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
$thumbnail1Field = "Thumbnail2_" . $i;
move_uploaded_file($_FILES[$thumbnail1Field]["tmp_name"],
"images/img/" . $file_name);
//Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
$thumbnail1Field = "Thumbnail1_" . $i;
move_uploaded_file($_FILES[$thumbnail1Field]["tmp_name"],
"images/th/" . $file_name);
}
?>
Edited by user Wednesday, November 5, 2008 9:54:10 AM(UTC)
| Reason: Not specified
|