-1

i was curious if there was a way for me to set up an ajax call such that a string would be recognized as a file.

i essentially created a XML via javascript that is in string format, and want to upload it, but the server looks for a file.

I was thinking that i would have to post it to a webservice such that it would post to a iframe as file contents or something and then upload it that way or some other hack around it.

EDIT: I was thinking this might be a solution? Creating a fake file? How to upload string as file with jQuery or other js framework

Community
  • 1
  • 1
Fallenreaper
  • 10,222
  • 12
  • 66
  • 129

1 Answers1

0

After looking at the same for how to upload a string as a file with Jquery and then looking at how the server processed the information. I determined that the data saved doesnt nessicarily have to be that of a file. When looking at responsees, all that information was in the string the next time it was pulled. I actually just removed the data and pushed it up and it returned what i wanted.

var myData = {
   user: top.USERNAME,
   pass: top.PW_HASH,
   secure: true,
   url: top.BASE_URL,
   ext: "foo",
   data:saveXML
 };

which as you can see, the data being passed in the object to my $.ajax wrapper was just the saveXML.

Fallenreaper
  • 10,222
  • 12
  • 66
  • 129