madebymany / sir-trevor-js

Rich content editing entirely re-imagined for the web
http://madebymany.github.io/sir-trevor-js/
MIT License
4.51k stars 399 forks source link

Issues with Image Upload Block #148

Closed peroosh-gattkins closed 10 years ago

peroosh-gattkins commented 10 years ago

Scratching my head with this one... And hope that someone can point me in the right direction.

My instance of Sir Trevor is rendering fine on screen, and when attaching an image, it appears without problem. AJAX is then used to post the image data to my uploadImage.php endpoint, where I'm attempting to capture the image data, and do some resizing of the image.

However, when I call the AJAX file, the attachment array only contains the filename and UID, there is nothing being passed as file data:

$attachment Array ( [name] => rabc_bw.jpg [uid] => st-block-14-1387533592975-raw )

I've checked the documentation, have added in the Sir Trevor uploader extension script, have even set the form wrapper on the page itself to have an enctype of "multipart/form-data", but nothing appears to make a difference?

Can anyone help point me in the right direction?

Graeme

peroosh-gattkins commented 10 years ago

bump

Still looking for an answer to the above, and if none if forthcoming, need to make a decision soon on whether to drop Sir Trevor as an option from the site altogether (have a January launch date for the site I'm working on...)

Can anyone help?

raffij commented 10 years ago

Some questions:

1) What browser are you using. 2) Have you customised the image block or uploader script in any way?

ninjabiscuit commented 10 years ago

The image upload block uses the file data api. your browser must be compatible with that feature. If not you could override the Image block to use a more compatible solution.

Are you sure that the PHP back end is working correctly and able to accept uploads from the file api?

Could you post some code samples?

On Friday, December 27, 2013, raffij wrote:

Some questions:

1) What browser are you using. 2) Have you customised the image block or uploader script in any way?

— Reply to this email directly or view it on GitHubhttps://github.com/madebymany/sir-trevor-js/issues/148#issuecomment-31256958 .

raffij commented 10 years ago

That's a better answer @ninjabiscuit

@frecosse I'm thinking you are printing the $_POST var. For file uploads you'll need to use the $_FILES var.

ninjabiscuit commented 10 years ago

Yup. What @raffij said

On Friday, 27 December 2013, raffij wrote:

That's a better answer @ninjabiscuit https://github.com/ninjabiscuit

@frecosse https://github.com/frecosse I'm thinking you are printing the $_POST var. For file uploads you'll need to use the $_FILES var.

— Reply to this email directly or view it on GitHubhttps://github.com/madebymany/sir-trevor-js/issues/148#issuecomment-31262798 .

peroosh-gattkins commented 10 years ago

Hi guys, I'd been trying various combinations of $_FILES to get the uploaded file moved to a temporary folder... Finally got it working with:

$_FILES['attachment']['tmp_name']['file']

Many thanks for pointing me in the right direction - can now start the fun stuff of resizing the uploaded image for use on the website!