Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
seeyousurf  
#1 Posted : Monday, October 12, 2009 2:26:58 AM(UTC)
seeyousurf

Rank: Member

Groups: Member
Joined: 5/19/2009(UTC)
Posts: 20

Robustupload use to upload images.

When loading the images above to approximately 2 mega bytes the system does not go forward continues to make attempts.

I wanted to know if there is a limit on the page and how I can disable the use of upload.php upload Verify integrity, because I think dipensa than the maximum weight of files to be uploaded.

thanks

This is my code:

<?php

//This variable specifies relative path to the folder, where the gallery with uploaded files is located.

//Do not forget about the slash in the end of the folder name.

$galleryPath = "../Gallery/";

$absGalleryPath = realpath($galleryPath) . "/";

function saveUploadedFiles()

{

global $absGalleryPath;

//Get the source file.

//NOTE: Since each file is uploaded in a separate request (because

//FilesPerOnePackageCount param equals to 1), you should work only

//with POST fields with index = 1 (such as SourceFile_1, FileName_1, etc).

if (!$_FILES["SourceFile_1"]['size'] || !is_uploaded_file($_FILES["SourceFile_1"]['tmp_name']))

{

header("HTTP/1.0 400 Bad Request");

return;

}

//Verify upload integrity. To do it, get the source file, compute hash value for it,

//and compare the result with the hash value calculated by Image Uploader.

//NOTE: In real-life application a single hash method is typically enough.

//Get SHA1 Hash.

//Check if this value is actually uploaded.

if (array_key_exists("HashCodeSHA_1", $_POST))

{

$postedSHA1Hash = $_POST ["HashCodeSHA_1"];

//Compute SHA1 hash. Since Image Uploader sends the hash value encoded with Base 64 algorithm

//the result should be also encoded with Base 64.

$actualSHA1Hash = base64_encode(pack("H*",sha1_file($_FILES["SourceFile_1"]['tmp_name'])));

//If the result differs from the uploaded one, the upload should be interpreted as corrupted.

if ($postedSHA1Hash != $actualSHA1Hash)

{

header("HTTP/1.0 400 Bad Request");

return;

}

}

//Get MD5 hash.

//Check if this value is actually uploaded.

if (array_key_exists("HashCodeMD5_1", $_POST))

{

$postedMD5Hash = $_POST ["HashCodeMD5_1"];

//Compute MD5 hash. Since Image Uploader sends the hash value encoded with Base 64 algorithm

//the result should be also encoded wi th Base 64.

$actualMD5Hash = base64_encode(pack("H*",md5_file($_FILES["SourceFile_1"]['tmp_name'])));

//If the result differs from the uploaded one, the upload should be interpreted as corrupted.

if ($postedMD5Hash != $actualMD5Hash)

{

header("HTTP/1.0 400 Bad Request");

return;

}

}

//If we reach this line, it means that file was not corrupted during upload.

//In this case we should save it to disk.

//Before saving uploaded files let's delete previously uploaded items.

//

//In this code sample each file is uploaded with a separate request. It means that this

//page will be called for each file individually (rather than once for all files). Therefore

//we need a way to determine whether this page is called for new upload session or not.

//

//To do it we check a PackageIndex POST field which returns a number of the request in the upload session.

//If it is the very first package we should delete all files we uploaded before.

//Otherwise, previously uploaded files belong to the same upload session and we should not delete them.

$packageIndex = $_POST ["PackageIndex"];

//If we receive the first file, we delete all files and thumbnails we uploaded before.

if ($packageIndex == 0)

{

//Delete source images

$handle = opendir($absGalleryPath . "/");

while (false !== ($file = readdir($handle)))

{

if (is_file($absGalleryPath . "/" .$file))

{

unlink($absGalleryPath . "/" . $file);

}

}

closedir($handle);

}

//NOTE: If you do not want to delete previously uploaded files, just

//remove or comment out the code above.

//Save the uploaded file to disk.

move_uploaded_file($_FILES["SourceFile_1"]['tmp_name'], $absGalleryPath . getSafeFileName($_FILES["SourceFile_1"]['name']));

}

//This method verifies whether file with such name already exists

//and if so, construct safe filename name (to avoid collision).

function getSafeFileName($fileName)

{

global $absGalleryPath;

$newFileName = $fileName;

$j = 1;

while (file_exists($absGalleryPath . "/" . $newFileName))

{

$newFileName = $j . "_" . $fileName;

$j = $j + 1;

}

return $newFileName;

}

saveUploadedFiles();

?>

Tamila  
#2 Posted : Monday, October 12, 2009 2:42:16 PM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Hello,

Image Uploader has no any limitations. It seems that your server has some limitations. I recommend you to read the following article:

http://www.aurigma.com/docs/iu/PHPSamples.htm

Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!

seeyousurf  
#3 Posted : Monday, October 12, 2009 7:10:06 PM(UTC)
seeyousurf

Rank: Member

Groups: Member
Joined: 5/19/2009(UTC)
Posts: 20

I use robust upload to upload file to amazon S3.

Qhen i upload file over 2Megabytes the system write waiting retry and the upload don't go next

Why

thanks

Tamila  
#4 Posted : Tuesday, October 13, 2009 7:16:18 PM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
hi,

As I remember you try to upload files to Amazon through additional library. I think the problem there. Unfortunately we cannot check it because we have not possibility to do it.

By the way, did you try the samples which Alex sent you before?

Edited by user Tuesday, October 13, 2009 7:17:14 PM(UTC)  | Reason: Not specified

Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.