Version 2.5 beta 3
I've been working on an wordpress image and video database using SWFupload as my fileuploader.
Uploading videos is going fairly well. (had a crash once or twice) but my image uploads get corrupted to a point where some cannot be thumbnailed. corrupt JPEG headers and what not. If I upload the images by ftp and run the thumbnailer there are no issues. most of the code is the same as the demos and I really cant figure where things are going wrong. Ofcourse could be flash
related but maybe you have some ideas on it. Many thanx in advance.
According to the SWF debug window all uploads were completed succesfully.
if you need more information just tell me what you need.
php code
if (move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $upload_file ) ) {
if (in_array($wpfs->file_extension($_FILES["Filedata"]["name"]), array("jpg","gif","png"))) {
list($width, $height) = getimagesize($upload_file);
$name = $_FILES["Filedata"]["name"];
$new_image = new pss_image;
$new_image->albumid = $album_id;
$new_image->name = $wpfs->title_prepare($_FILES["Filedata"]["name"]);
$new_image->filename = $wpfs->file_prepare($_FILES["Filedata"]["name"]);
$new_image->thumb = "image-".$wpfs->file_prepare($wpfs->strip_extension($name)).".jpg";
$new_image->location = $album_location;
$new_image->width = $width;
$new_image->height = $height;
$new_image->type = $new_image->type();
$new_image->author = 1;
$new_image->adddate = current_time('mysql');
$new_image->size = $_FILES["Filedata"]["size"];
$new_image->save();
//$wpfs->thumb($upload_file, WV_THUMB_PATH."image-".$wpfs->file_prepare($wpfs->strip_extension($name)).".jpg");
}
}
the swf script
var swfu;
SWFUpload.onload = function () {
var settings = {
flash_url : "'. WV_PLUGIN_URL .'/swfupload/swfupload.swf",
flash9_url : "' .WV_PLUGIN_URL .'/swfupload/swfupload/swfupload_fp9.swf",
upload_url: "'.$_SERVER['PHP_SELF'].'?page=images&upload=images",
post_params: {
"token" : "set",
"albumid" : "'.$album_id.'",
"albumname" : "'.$album_name.'",
},
file_size_limit : "250 MB",
file_types : "*.jpg;*.png;*.gif",
file_types_description : "Image Files",
file_upload_limit : 500,
file_queue_limit : 250,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: true,
// Button Settings
button_image_url : "'. WV_PLUGIN_URL.'/swfupload/XPButtonUploadText_61x22.png",
button_placeholder_id : "spanButtonPlaceholder",
button_width: 61,
button_height: 22,
// The event handler functions are defined in handlers.js
swfupload_preload_handler : swfUploadPreLoad,
swfupload_load_failed_handler : swfUploadLoadFailed,
swfupload_loaded_handler : swfUploadLoaded,
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete // Queue plugin event
};
swfu = new SWFUpload(settings);
}
May 13, 2010 - 3:48pm
Are you resizing the images?
May 14, 2010 - 10:55am
no i havent been resizing. i have made a barebones sample and it still isnt working. Depending on the browser im using i get a lot of corrupt images or just some. Maybe it has something to do with javascript speed or flash version or wamp.
not sure what else i can try..
May 17, 2010 - 10:19am
The Flash Player is entirely responsible for the file upload and the data transmitted. SWFUpload wraps the Flash provided functionality and works around some bugs in the Flash Player.
Some suggestions:
1) MD5 the original file and uploaded file to verify it wasn't corrupt to begin with
2) Some versions of PHP had issues with nulls in binary data (testing using a normal HTML INPUT upload "should" result in the same kind of corruption if this is the case.
3) Use a packet sniffer (i.e., Fiddler or Wireshark) to examine what is actually being sent and see if you can spot anything fishy.
May 19, 2010 - 12:07am
I've been using Zone Alarm free edition for my firewall and if I shut that down everything worked normally. Maybe some bug on localhost on Zone Alarm. Thanx for the help!