0

I have a mobile application which needs the user to attach some files from his mobile and upload it on the server. Is there a way to upload files on the server from mobile using JQUERY/JAVASCRIPT ?

I found many doin it with PHP/ASP.NET-c#...but my need is HTML with JAVASCRIPT/JQUERY...!!

FURTHER INFO ON MY APP (Kindly neglect it if not needed):

I have my front-end in HTML/CSS..I have a WCF service running on my server that does the communication with the database..I use the WCF service by making ajax calls from my client side..

I achieved all the other operations such as insert/delete/update/retrieve data from DB using these services only.. I was wondering if there is any possibility to do the "upload files on the server" task also using these webservices...but didnt get any idea about it !!!

Here is another question exactly precise to my need !! File upload service using WCF along with jquery(AJAX) and html client

Sorry if i m wrong anywhere..This stuff is totally new to me and so i need all your guidance..

Community
  • 1
  • 1
Legolas
  • 5
  • 7

3 Answers3

0

To save an uploaded file, you need an server side script (PHP, ASP e.g.) to move the uploaded file from the servers tmp directory, to your desired location.

Maybe can you edit your serves configuration so it writes the uploaded files automatic to your desired location, but I wouldn't suggest that due to security reasons.

George Boot
  • 585
  • 2
  • 8
  • 17
  • @Gerge Boot:I m curious to know more about your second line of answer..Keeping the security reasons apart,Is it possible to write uploaded file directly on my server ?? – Legolas Mar 13 '13 at 12:05
  • Yes, sure you can. Take a look at http://stackoverflow.com/questions/6425034/php-cant-find-tmp-directory#6432711. You will probably only need to change the file permissions of the uploaded files, but I'm sure Google will help you out with that ;-) – George Boot Mar 14 '13 at 06:51
  • I wont be using a PHP script..I use WCFServices in my application..so is der any reference to a WCFService for uploading files on the server ??? – Legolas Mar 14 '13 at 07:36
0

Is this a native application? If it's just a website then you'll struggle as safari on iPhone doesn't support file uploads. If it's a phonegap application you could maybe hook into the file API...

Alkem1st
  • 41
  • 2
  • This is not a native application..I am building it using something called "PHONEGAP" only... I m not aware of phonegap fully...Is this possible to achieve using phonegap ? – Legolas Mar 13 '13 at 12:11
0

Ok some of the points worth mentioning.

  1. When you wanted to upload file to server you have to POST file with multipart content type of the form. For this you might need to write WCF service on server end accordingly. I am not having good experience of WCF but this post should help may be

    <form method="POST" enctype="multipart/form-data" >

  2. HTML5 file API and XHR Level 2 specification you can upload files to server. As they are new features and JS and DOM involved yes you can consum and do it in JQuery as well as long as your browser is supporting them.

With these things i am not sure if there should be any issue while uploading files to the server.

Community
  • 1
  • 1
Anil Namde
  • 6,452
  • 11
  • 63
  • 100