Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

Uploadify IO error on Mac (fix / patch)


Go to End


3 Posts   6072 Views

Avatar
brice

Community Member, 52 Posts

17 November 2010 at 10:36am

I ran across an issue when using Uploadify within HasMany/ManyMany FileDataObjectManager fields. I would get an IO error (#2038) on the Mac platform ... but not on Windows/PC.

After trying & reading everything.. it *appears to me* that the issue is related to a character limit of flashvars on the Mac platform.

As a workaround, attached is a patch that shortens the "script" flashvar passed to the [jQuery] Uploadify plugin. In short; it removed superfluous URL info that ComplexTableFields add. E.g. it changes:

%2Fpaulickreport%2Fadmin%2FEditForm%2Ffield%2FPhotos%2FUploadifyForm%2Ffield%2FUploadedFiles%2Fupload%3Fctf%5BPhotos%5D%5Bstart%5D%3D0%26ctf%5BPhotos%5D%5Bper_page%5D%3D10%26ctf%5BPhotos%5D%5Bshowall%5D%3D0%26ctf%5BPhotos%5D%5Bsort%5D%3D%60NewsPost_Photos%SortOrder%26ctf%5BPhotos%5D%5Bsort_dir%5D%3D%26ctf%5BPhotos%5D%5Bsearch%5D%3D%26ctf%5BPhotos%5D%5Bfilter%5D%3D%26ctf%5BPhotos%5D%5Bview%5D%3D%26ctf%5BPhotos%5D%5Bonly_related%5D%3D

to

%2Fpaulickreport%2Fadmin%2FEditForm%2Ffield%2FPhotos%2FUploadifyForm%2Ffield%2FUploadedFiles%2Fupload

Below is the patch to code/UploadifyField.php

Index: www/uploadify/code/UploadifyField.php
===================================================================
--- www/uploadify/code/UploadifyField.php	(revision 145)
+++ www/uploadify/code/UploadifyField.php	(working copy)
@@ -418,8 +418,16 @@
 
 		if($this->form) {
 			if(!$this->getSetting('script')) {
-				$this->setVar('script',urlencode(Director::baseURL().Director::makeRelative($this->Link('upload'))));		
+				// long script strings cause IO error on Apple/Mac Flash platforms\
+				// so parse out complextablefield
 
+				$script = urlencode(Director::baseURL().Director::makeRelative($this->Link('upload')));
+				if($pos = strpos($script,'%3Fctf'))
+				{
+					$script = substr($script,0,$pos);
+				}
+				$this->setVar('script',$script);
+
 			}
 			if(!$this->getSetting('refreshlink')) {
 				$this->setVar('refreshlink', Director::baseURL().Director::makeRelative($this->Link('refresh')));

Avatar
brice

Community Member, 52 Posts

20 April 2011 at 8:25am

Cleaned up patch is available @ https://github.com/briceburg/Uploadify/commit/d5d0bea81c393d8fe8d5fb654ddf836ffb00cbaa -- a pull request has been sent to get this into the official Uploadify git repository at GitHub. New patch is more effective.

Avatar
qbahamutp

Community Member, 8 Posts

6 December 2011 at 12:59am

Thanks so much for this, brice. This just got us out of a little bind that otherwise might've taken ages.

Cheers dude (: