How to upload multiple images on WCF in a single Request and not in bytes format - image-uploading

I searched many sites in uploading multiple images in a single request on WCF. The webservices showing in the to uploading images can be converted in to into bytes format to saving the directory. My requirement is uploading multiple images in single request and some pf the parameters also coming in the http post method. how store those images in server using WCF?

I am not sure why you want this?
If you make multiple request it would be more user friendly.
In Single request you can't upload multiple images and also its not recommended.

Related

Best approach to upload the file via REST api from API gateway

User Case: Customer can upload the file from the public REST api to our S3 bucket and then we can process the file using downstream services.
After doing some research I am able to find 3 ways to do it:
Uploading using OCTET-STREAM file type
Upload the file using form-data request
Upload the file using the pre-signed URL
In first 2 cases user will send the binary file and we will upload the file to S3 after file validation.
In the 3rd method user have to hit 3 apis. First API to get the S3 pre-signed URL which will give access to the user to upload the file to S3. In second hit user will upload the file to that s3 pre-signed URL. After the user complete the upload he will send the request to process the file.
Do we have any security issues with step 3? As user can misuse the pre-signed URL with malicious file.
Which of these method is best according to industry practice?
Details of each approach:
1. Uploading using OCTET-STREAM file type
Pros:
This method is good to upload file types which can be opened in some application such as xlsx.
1 API hit. Direct file upload
Cons:
This option is not suitable to upload multiple files. If in future we need to support multiple file upload this should be changed to multipart/form-data (A2).
No metadata can be send as body parameter. Metadata can be send in headers.
2. Upload the file using form-data request
User will upload the file with the API request by attaching it as multipart form.
Pros
We can send multiple files at the same time.
We can send extra parameters in the body.
3. Upload the file using the pre-signed URL
Cons
Customer have to hit the 3 APIs to upload the file. (2 API hits to upload and then 1 more API hit to check the process the file)
If you want them to load data into a bucket, the best way will almost always be the pre-signed URL. This gives you complete control over how you hand out access to the bucket, but also allows them to directly upload into the bucket when they have the access.
In the first two examples the user can send malicious data to your API, potentially DOSing the server / incurring costs on you to manage the payloads as you have no control over access (it is public).
In the third case they can request a URL from you, but that is it, other than spamming you for requests for URLs, unless you grant them a URL they can't access the bucket or do anything else. This seems much better than spamming your upload with large junk files and having you process them before you decide you didn't want them anyway.
Finally using the pre-signed URL is the pattern AWS would expect you to use, and so have a lot of support for managing the access, roles, logging and monitoring etc that you would want to put around this service. When you are standing up the API yourself this will all be up to you to manage.

How can I enter (login + upload images to) a webapp using Swift 4

I've got a very basic question. To automate my pic upload process I have written a Swift App that takes customized pictures. Now I want those pictures to be sent to a specific "official" webapp. Therefore I have to login to my webapp account and sent the pictures to it.
I really don't know which is the best way to proceed. Maybe you guys can help me - thanks a lot!
This question is too abstract you need to specify the API "your" official service uses.
In general, you need to write API from your side (authorisation method, uploading image method). Then depending on auth method of your service you need to handle authorised connection - it can be session / token in url as query parameters / token in headers or some other ways. Uploading can be also different, the frequently method for it is multipart data but it can be base64 encoded string in request body.
If you have only those two requests I'd recommended to you Alamofire without any additional libs

Send batched data to Google Calendar with Scala/Spray

We are successfully sending data for new, changed, and removed events to Google Calendar from a Scala app using Spray HTTP. However, we are currently sending one event per request, and this becomes very inefficient when there are multiple events for the current user. In these cases we would like to send batched data, as described here:
https://developers.google.com/google-apps/calendar/batch
The documentation begins with:
A batch request is a single standard HTTP request containing multiple
Google Calendar API calls, using the multipart/mixed content type.
Within that main HTTP request, each of the parts contains a nested
HTTP request.
Since we are already using spray http we would like to use its support for multipart/mixed requests (spray.http.MultipartContent) but it isn't clear that this is possible since the parts must consist of one or more spray.http.BodyPart instances and there doesn't seem to be a way to turn a spray.http.HttpRequest into a BodyPart.
Has anyone successfully done this? We are also taking a look at the Google API Client for Java but would rather not go down that path if there is a more Scala-friendly way to do it.

Google Cloud Storage Resumable Upload - Is uploadid Resumable

I am trying to figure out which is better: resumable upload or signed url. For upload only. Does anyone know if one uploadid can be used by multiple uploads? Or how can a user upload multiple files using one uploadid?
If your goal is to allow users without Google credentials to upload objects, signed URLs are your best bet. This is their intended purpose.
You can use uploadIds to accomplish the same goal, but they are much less featureful in this regard. For example, they do not support setting expiration times, and the server must set all parameters other than the data itself.

storing data on a server from an app

How does one store data on a server from an iOS app?
If I create, e.g. a JSON object, how can I send this to the server and save it on the server as the value from some Key?
I am using MAMP at the moment and have seen examples of how to create the item on the server and get it to the phone, I would like to learn how to create objects on the device, send them to the server for storage. such as a JSON object and store it on the server as a value for e.g. a key with an ID.
I would greatly appreciate any help with this.
Have a look at NSUrlConnection. Using it you can synchronously & asynchronously transmit data to your server using a POST request.
Check out ASIHTTPRequest. It can GET/POST from a URL asynchronously and for storage, if the data set is small enough look at NSUserDefaults.
On the server side (if the scripts are PHP), you can handle the data in the $_POST and $_GET variables just as if they were populated from the web.
If you wanted you could post the variables individually in their own $_POST or $_GET variables, or as 1 JSON string which you could decode when you receive it.
You may also want to check out RestKit which will make things easier when dealing with downloading/uploading/processing JSON.