Hello Guys, i am experiencing some issues with my file uploader component. I have used this over the years and it always worked perfectly. Its a file uploader in flex that uses a coldfusion component to upload files(pics) to a folder on the server and picks the name of the file after it has been uploaded into the folder so that in case it overwrites the name, my flex component gets the overwritten name.
Ever since i upgraded to coldfusion 11, i have had issues with it. The file is uploaded well but the name of the uploaded file doesn't show up in my flex textinput. Maybe coldfusion 11 changed a few things and can't figure it out. Please help me.
Below is the flex component (picUploader.mxml)
<?xml version="1.0" encoding="utf-8"?>
<mx:FormItem xmlns:mx="http://www.adobe.com/2006/mxml"
width="230"
indicatorGap="0"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import mx.controls.Alert;
import components.progress_popup;
private var fileRef:FileReference;
private var maxFileSize:Number=650;
private var progress_win:progress_popup;
private function init():void
{
fileRef=new FileReference();
fileRef.addEventListener(Event.SELECT, fileRef_select);
fileRef.addEventListener(Event.OPEN, openHandler);
fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);
fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadDataComplete);
fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
}
private function browseAndUpload():void
{
var imageTypes:FileFilter=new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
fileRef.browse([imageTypes]);
message.text="";
img.text="";
}
private function fileRef_select(event:Event):void
{
var request:URLRequest=new URLRequest("coldfusion/picUpload.cfm")
//Get the filesize
var fileSize:Number=Math.round(fileRef.size / 1024);
//If the current file size is less or equal to our max file size then up
if (fileSize <= maxFileSize)
{
try
{
fileRef.upload(request);
}
catch (err:Error)
{
message.text="ERROR: zero-byte file";
}
//image.text = event.currentTarget.name;
createdprogressPopup();
}
else
{
//If the file is to big, alert the user
Alert.show("File is to large! Please select a file smaller than " + maxFileSize + "kb." + "Scale your image down to 400 * 300 pixels or 300 * 400 pixels.", 'oooch!', Alert.OK);
}
}
private function fileRef_complete(event:Event):void
{
message.text+=" (complete)";
removeMe();
}
private function createdprogressPopup():void
{
progress_win=progress_popup(PopUpManager.createPopUp(this, progress_popup, true));
}
private function removeMe():void
{
PopUpManager.removePopUp(progress_win);
}
private function progressHandler(event:ProgressEvent):void
{
progress_win.uploadProgress.setProgress(event.bytesLoaded, event.bytesTotal);
}
private function openHandler(event:Event):void
{
progress_win.uploadProgress.label="Uploading %3%% of image file.";
}
public function uploadDataComplete(event:DataEvent):void
{
var result:XML=new XML(event.data);
img.text+=result.message;
/* status_txt.text += 'Upload Data Complete\n'
status_txt.text += 'RESULT: ' + result.toString() + '\n'
status_txt.text += 'STATUS: ' + result.status + '\n';
status_txt.text += 'MESSAGE: '+ result.message; */
}
]]>
</mx:Script>
<mx:HBox width="100%">
<mx:TextInput width="100%"
id="img"
editable="false"
maxChars="50"/>
<mx:Button label="Upload"
click="browseAndUpload();"/>
</mx:HBox>
<mx:Label id="message"/>
</mx:FormItem>
Below is the Coldfusion Component (picUpload.cfm)
<cfsetting RequestTimeout = "600">
<cfset mediapath = expandpath('../profilePics')>
<!---<cftry>--->
<cfprocessingdirective suppresswhitespace="true">
<cftry>
<cffile action="upload" filefield="filedata" destination="#MediaPath#" nameconflict="makeunique" accept="image/jpeg,image/jpg,image/png,image/gif"/>
<!--- Begin checking the file extension of uploaded files --->
<cfset acceptedFileExtensions = "jpg,jpeg,gif,png"/>
<cfset filecheck = listFindNoCase(acceptedFileExtensions,File.ServerFileExt)/>
<!--- read the image ---->
<cfimage action="read" name="uploadedImage" source="#MediaPath#/#file.serverFile#" >
<cfset ImageScaleToFit(uploadedImage,"",142,"bilinear")>
<cfimage source="#uploadedImage#" action="write" destination="#MediaPath#/#file.serverFile#" overwrite="yes">
<cfimage action="read" name="myImage" source="#MediaPath#/#file.serverFile#" >
<cfset ImageCrop(myImage,0,0,142,142)>
<cfimage source="#myImage#" action="write" destination="#MediaPath#/#file.serverFile#" overwrite="yes">
<cfxml variable="status"><result><status>OK</status><message><cfoutput>#file.serverFile#</cfoutput></message></result></cfxml>
<cfcatch>
<cfxml variable="status"><result><status>Error</status><message><cfoutput>#cfcatch.Message#</cfoutput></message></result></cfxml>
</cfcatch>
</cftry>
<cfoutput>#status#</cfoutput>
</cfprocessingdirective>
<!---</cftry>--->
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
Hello Guys, any help on this issue?
any help guys? am stuck and can't figure out where the problem is
Anyone out there with a solution to this issue? i have been using that code for so long and it worked perfectly. But now for some reason the uploaded file name doesn't appear in the textinput even if the file is actually uploaded onto the server
I think you’re the only flex developer left?
From: flexc...@yahoogroups.com [mailto:flexc...@yahoogroups.com]
Sent: 23 September 2015 14:05
To: flexc...@yahoogroups.com
Subject: [flexcoders] Re: uploading files in flex using coldfusion 11
Anyone out there with a solution to this issue? i have been using that code for so long and it worked perfectly. But now for some reason the uploaded file name doesn't appear in the textinput even if the file is actually uploaded onto the server
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
As Julian said, you may very well very well be the last flex developer left. And for that matter, the last ColdFusion developer.
It could be a server environment change that is incompatible now with either Flex or ColdFusion. Technologies change and move on, sorry if that doesn’t help. Good luck.
Jason Merrill
Instructional Technology Architect II
Bank of America Global Technology and Operations
c: 703.302.9265
From: flexc...@yahoogroups.com [mailto:flexc...@yahoogroups.com]
Sent: Wednesday, September 23, 2015 9:05 AM
To: flexc...@yahoogroups.com
Subject: [flexcoders] Re: uploading files in flex using coldfusion 11
Anyone out there with a solution to this issue? i have been using that code for so long and it worked perfectly. But now for some reason the uploaded file name doesn't appear in the textinput even if the file is actually uploaded onto the server
One of the most amazing things I’ve ever seen is the speed with which all the flash and flex developers abandoned the tools once it was clear that Apple had won the battle of the Flash player.
From: flexc...@yahoogroups.com [mailto:flexc...@yahoogroups.com]
Sent: 23 September 2015 14:30
To: flexc...@yahoogroups.com
Subject: RE: [flexcoders] Re: uploading files in flex using coldfusion 11
As Julian said, you may very well very well be the last flex developer left. And for that matter, the last ColdFusion developer.
It could be a server environment change that is incompatible now with either Flex or ColdFusion. Technologies change and move on, sorry if that doesn’t help. Good luck.
Jason Merrill
Instructional Technology Architect II
Bank of America Global Technology and Operations
c: 703.302.9265
From:
flexc...@yahoogroups.com [mailto:flexc...@yahoogroups.com]
Sent: Wednesday, September 23, 2015 9:05 AM
To: flexc...@yahoogroups.com
Subject: [flexcoders] Re: uploading files in flex using coldfusion 11
Anyone out there with a solution to this issue? i have been using that code for so long and it worked perfectly. But now for some reason the uploaded file name doesn't appear in the textinput even if the file is actually uploaded onto the server
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
Anyone out there with a solution to this issue? i have been using that code for so long and it worked perfectly. But now for some reason the uploaded file name doesn't appear in the textinput even if the file is actually uploaded onto the server
-- Margo Powell Applications Analyst/MS Computer Science Nutrition in Medicine Project Nutrition Education for Practicing Physicians Initiative Department of Nutrition University of North Carolina at Chapel Hill 800 Eastowne Dr, Suite 100 Chapel Hill, NC 27514 919-408-3320 ext 30 margo_...@unc.edu www.nutritioninmedicine.org
This wouldn’t have anything to do with Flex…I’m assuming the XML being returned just doesn’t have the message element populated, correct? Or is nothing being returned?
I’d try a few things before getting all worked up…
1) If you call the picUpload.cfm from another .cfm module is the XML output what you expected?
2) I’d also probably not use the variable name “status”…it’s a pretty common reserved word in all languages, and since you weren’t scoping the variable, you might have an issue there anyway…
3) If not, try hardcoding the XML string with the values to see what you get back…and be sure not to put line breaks in…
<cfset variables.status = ‘<?xml version="1.0" encoding="UTF-8" ?><result><status>OK</status><message><cfoutput>#file.serverFile#</cfoutput></message></result>’>
<cfoutput>#variables.status#</cfoutput>
4) As an aside, if you *must* use CFXML, try setting the returned content to the text/xml mime type using CFContent right after your cfprocessing directive:
<cfcontent type="text/xml; charset=utf-8">
5) You might want to try to convert it to a string, and automatically have CF prepend the <?xml …> XML declaration:
<cfset myvar=toString(xmlobject)> <cfoutput>#myvar#</cfoutput>
On a different note…
Why don’t you use CF Remoting and have Flex call a CFC method to do the upload and return the file name? We don’t do URLRequests ourselves for security reasons, and we don’t have issues with CF11 and file uploads.
From: flexc...@yahoogroups.com [mailto:flexc...@yahoogroups.com]
Sent: Wednesday, September 23, 2015 9:05 AM
To: flexc...@yahoogroups.com
Subject: RE: [flexcoders] Re: uploading files in flex using coldfusion 11
I think you’re the only flex developer left?
From: flexc...@yahoogroups.com [mailto:flexc...@yahoogroups.com]
Sent: 23 September 2015 14:05
To: flexc...@yahoogroups.com
Subject: [flexcoders] Re: uploading files in flex using coldfusion 11
Anyone out there with a solution to this issue? i have been using that code for so long and it worked perfectly. But now for some reason the uploaded file name doesn't appear in the textinput even if the file is actually uploaded onto the server
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it.
Please do not use, copy or disclose the information contained in this
message or in any attachment. Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.
This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.
Well, there was a time when the world held its breath for Apple putting the Flash Player in iOS. Is didn’t, and the flash and flex lists died. Just my experience.
Now we have browser automagically preventing flash, facebook asking for it to be removed etc etc. Most people have moved away from it.
From: flexc...@yahoogroups.com [mailto:flexc...@yahoogroups.com]
Sent: 23 September 2015 15:28
To: flexc...@yahoogroups.com
Subject: Re: [flexcoders] Re: uploading files in flex using coldfusion 11
That's news to me, that Apple "won the battle of the Flash Player." I have an iOS Flex app in the Apple App Store. And the Flash player is probably still installed in about 97% of desktop browsers.
From: "Julian Tenney
Julian...@nottingham.ac.uk [flexcoders]" <flexc...@yahoogroups.com>
To: "flexc...@yahoogroups.com" <flexc...@yahoogroups.com>
Sent: Wednesday, September 23, 2015 9:33 AM
Subject: RE: [flexcoders] Re: uploading files in flex using coldfusion 11
One of the most amazing things I’ve ever seen is the speed with which all the flash and flex developers abandoned the tools once it was clear that Apple had won the battle of the Flash player.
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
In my world of enterprise development Flex is still alive and well... Obviously different approaches for mobile development (gaming or non) which are better but as far as the desktop goes Flex is still "the solution of choice" for my needs. Yeah, obviously the lists died and we are never going to see Flash adopted on mobile devices or tablets through the player, but there is still definitely a niche for Flex and native applications developed in it.
What does this have to do with helping the original poster with his issue?
But, just because I don’t like Trolls who bash Flash or anything else just to try to show their superior intellect and insufferable opinions, if “most people” aren’t using it, Adobe wouldn’t waste money on updates for it. They’d declare it dead and be done with it. Or isn’t that the way it’s done in the UK?
Sure, I understand that, but in my world, elearning, I don’t have resources to develop more than one codebase, and I cannot have a strategy that doesn’t embrace the iPad, so HTML5 and JS is the answer.
It’s a great shame as I miss a proper OO language, and really liked working with Flex but it simply does not fly for us.
I’m also very leery about getting caught in proprietary formats as an ex-authorware developer, and dependent on proprietary technology (i.e. the flash player) is a risk I no longer want to take.
Anyone out there with a solution to this issue? i have been using that code for so long and it worked perfectly. But now for some reason the uploaded file name doesn't appear in the textinput even if the file is actually uploaded onto the server
On 9/24/2015 12:15 AM, Tom McNeer tmc...@gmail.com [flexcoders] wrote:
>
>
> ignoring the snotty emails about Flex and ColdFusion, what does the actual
and that this list is mostly a ghost town. better off on the apache one though
this seems like a cf issue so maybe SO or the adobe forums.
cf's alive & kicking and so is apache flex.
run it from an html form pointing at the same cf page & see what the cf11 server
is actually spitting out. and as suggested DEBUG the flex side of things, what
exactly is the error (though if you're running a debug player you should have
seen any errors by now).
“Abandoned” is a pretty extreme word. There are a lot of people still using it and it’s still getting updated… what, 3 years after Adobe donated it to Apache? New mobile, desktop and web projects are still created in Flex every day… just not at the fury of what once was.
Now… if we could only get FlexJS going (ahem, Alex).