appcoda / RESTful-File-Upload-Demo

A demo app showing you how to work with RESTful API for file upload

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uploading multiple files to PHP server

Qberon opened this issue · comments

commented

Thank you for a detailed very good explained class and tutorial

For uploading multiple files to server under PHP you need to declare file names as an array like this
name: "uploadedFile[1]" , name: "uploadedFile[2]", name: "uploadedFile[3]"

let textFileURL = Bundle.main.url(forResource: "sampleText", withExtension: "txt")
let textFileInfo = RestManager.FileInfo(withFileURL: textFileURL, filename: "sampleText.txt", name: "uploadedFile[1]", mimetype: "text/plain")

let pdfFileURL = Bundle.main.url(forResource: "samplePDF", withExtension: "pdf")
let pdfFileInfo = RestManager.FileInfo(withFileURL: pdfFileURL, filename: "samplePDF.pdf", name: "uploadedFile[2]", mimetype: "application/pdf")

let imageFileURL = Bundle.main.url(forResource: "sampleImage", withExtension: "jpg")
let imageFileInfo = RestManager.FileInfo(withFileURL: imageFileURL, filename: "sampleImage.jpg", name: "uploadedFile[3]", mimetype: "image/jpg")