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

Notification

Icon
Error

Options
Go to last post Go to first unread
info@bjb.at  
#1 Posted : Tuesday, August 25, 2015 1:36:05 PM(UTC)
info@bjb.at

Rank: Member

Groups: Member
Joined: 8/13/2008(UTC)
Posts: 14

Hi,

I've the following code to allow users to change the size of an uploaded image, which works fine with activex / java, but does not work with html5/flash:

Quote:
//activeX

var imageUploader = $au.uploader({ ....

Quote:
//html5

var imageUploader = $au.imageUploaderFlash({ ....

Quote:

function beforePackageUploadHandler()

{

client_x = parseInt(document.getElementById('client_x').value)

client_y = parseInt(document.getElementById('client_y').value)

if ((!isNaN(client_x)) && (!isNaN(client_y)))

{

var c = imageUploader.converters().get(0);

c.mode('*.jpg=Thumbnail;*.*=SourceFile')

c.thumbnailWidth(client_x);

c.thumbnailHeight(client_y);

}

else

{

var c = imageUploader.converters().get(0);

c.mode('*.*=SourceFile')

}

}

as I enter the client_x / client_y values, no file is uploaded at all (html5/flash only)

best regards

Bernd

Andrew  
#2 Posted : Tuesday, August 25, 2015 7:41:47 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Hi Bernd,

The ability to modify the converter settings in the BeforePackageUpload event handler is available in the upcoming update. Hopefully we will release it on the next week.

However it is strange that it does not send any files. It should just ignore changes in the BeforePackageUpload event handler. Could you please post all settings (including the initial converters)?

info@bjb.at  
#3 Posted : Wednesday, August 26, 2015 2:33:27 AM(UTC)
info@bjb.at

Rank: Member

Groups: Member
Joined: 8/13/2008(UTC)
Posts: 14

Hi, my setup:

Quote:

var imageUploader = $au.imageUploaderFlash({

id: 'imageUploader1',

...

uploadSettings: {

actionUrl: 'bild_multiupload.php',

filesPerPackage: 1

},

converters: [

{ mode: '*.*=SourceFile'}

],

...

the difference if I enter values for client_x and client_y is the following:

POST to bild_multiupload.php without

Quote:

c.mode('*.jpg=Thumbnail;*.*=SourceFile')

c.thumbnailWidth(client_x);

c.thumbnailHeight(client_y);

works:

Quote:
-----------------------------203181318417916

Content-Disposition: form-data; name="File0_0"; filename="myfile.jpg"

Content-Type: image/jpeg

with it:

does not work

Quote:
-----------------------------140361634015869

Content-Disposition: form-data; name="File0_0"; filename="blob"

Content-Type: image/jpeg

"blob" is not accepted by bild_multiupload.php due file restrictions, so upload fails

bild_multiupload.php:

Quote:

<?php

$allowed = array('gif','png' ,'jpg','jpeg','doc','docx','xls','xlsx','ppt','pptx','pdf','txt','ai','cdr','html','htm');

$dateiname = preg_replace('/[^A-Z0-9\.\-_]/i','',$_FILES["File0_0"][name]);

$dateiname = preg_replace('/_Thumbnail0.jpg/i','',$dateiname);

$ext = pathinfo($dateiname, PATHINFO_EXTENSION);

if(!in_array(strtolower($ext),$allowed) )

{

die('error');

}

else

{

move_uploaded_file($_FILES["File0_0"][tmp_name], "tmp/tmp_".$dateiname);

}

?>

Edited by user Wednesday, August 26, 2015 2:44:05 AM(UTC)  | Reason: Not specified

Andrew  
#4 Posted : Thursday, August 27, 2015 5:03:26 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Unfortunately some browsers don't put the filename to the POST request when uploading a file generated within JavaScript (it happens when we create a resized copy). So I recommend to allow files without a file extension and when you save a file to disk, use the POST variable SourceName_0 instead of the filename taken from $_FILES.
Andrew  
#5 Posted : Saturday, September 5, 2015 12:53:43 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
We have just released 8.5.33. Now you can update the convertor settings in BeforePackageUpload event.
Users browsing this topic
Guest
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.