Hello all! I'm searching about my issue or flex `issue and I can`t found the
error. Please, help me.
I'm trying to upload a file using the FileReference class and it work fine just
in my computer. When I try in server, the error appears.
Following my source code:
Init function:
private var fileRef:FileReference;
fileRef = new FileReference();
//Upload event
fileRef.addEventListener(Event.COMPLETE, completeEvent);
fileRef.addEventListener(Event.SELECT, selectEvent);
fileRef.addEventListener(ProgressEvent.PROGRESS, progressEvent);
fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, Utils.handleFault);
//Upload Callback event
fileRef.addEventListener(IOErrorEvent.IO_ERROR, Utils.ioErrorHandler);
fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, handleXMLFileUpload);
upload function
var sendVars:URLVariables;
var request:URLRequest;
sendVars = new URLVariables();
request = new URLRequest();
sendVars.command = "FILE.UPLOAD";
sendVars.tematica = tematicaId;
sendVars.field1 = txtColunaUp01.text;
request.data = sendVars;
request.url = Utils.urlHost + "File";
request.method = URLRequestMethod.POST;
try{
fileRef.upload(request, "upload", true);
}
catch(error:Error){
trace(error);
}
I just using this code like all examples founded in google, but when this is in
server it does not work because the variable upload set in fileRef.upload is
received by server like a String and not a File.
Does anyone know what`s the problem?
PS.: Following my crossdomain.xml file and in creationComplete function I call
these methods:
// Starting the get crossdomain file
Security.allowDomain(Utils.urlHost);
Security.loadPolicyFile(Utils.urlHost + Utils.crossDomainPolicyFile);
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>
PS2.: In flash player log, these messages appears:
Warning: Ignoring 'secure' attribute in policy file from
http://127.0.0.1/crossdomain.xml. The 'secure' attribute is only permitted in
HTTPS and socket policy files. See http://www.adobe.com/go/strict_policy_files
for details.
Warning: Ignoring 'secure' attribute in policy file from
http://127.0.0.1/crossdomain.xml. The 'secure' attribute is only permitted in
HTTPS and socket policy files. See http://www.adobe.com/go/strict_policy_files
for details.
OK: Policy file accepted: http://127.0.0.1/crossdomain.xml
PS.: My flash player version is 10.0.32 and my Flex SDK is 3.5. I'm using the
Flex Builder IDE and Firefox browser.