i kinda sorted out my problems with forms with using serializeArray, but as you may know it lacks of support for input/file, so decide to merge it with my serialized data. Now i create the object and everything i get the name of the file with .val(). But i can’t the image source. For example i wanna do this:
alert(jQuery('.inputBox#pic').attr(src));
var obj = {'name' : 'pic',
'value' : jQuery('input#pic').src};
The only problem is that it doesn’t work. I can’t get the image source ready for upload. and without it i can’t make a successful POST request.
You can’t post a file that way.
Even if you were able to get the complete source of the file (which is not even allowed in some browsers), it will be an address to a local file that you can not access.
The only way to post a file to the server is by posting the form that the upload control is in. There is no other way to get a file from the client computer, for security reasons. This means that you have to post the actual form on the page, you can’t make an AJAX post.