-
Notifications
You must be signed in to change notification settings - Fork 65
Upload Feature #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload Feature #233
Conversation
csoni111
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine with images from the Library but couldn't test with images directly from Camera.
| else { | ||
| url = ServerApi.shared!.getShareUri(share)!.absoluteString | ||
| } | ||
| Network.shared.uploadFile(url, data: image.jpegData(compressionQuality: 100)!, fileName: "IMG.jpeg") { success in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the static name IMG.jpeg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used static name IMG.jpeg so that we would get file names as IMG.jpeg, IMG_xyz.jpeg (where xyz is a number, this when IMG already exists), IMG_abc.jpeg etc.
I couldn't get the name of the selected file, from the file I get something in the format "some_number.jpeg", which is not the file name.
Or should I pass that "some_number.jpeg" in place of IMG.jpeg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is xyz or abc ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He means on the first upload the filename will be like IMG.jpeg then after that, it will be IMG_yyyymmdd-HHMM.jpeg format. This file renaming is handled by our fs when it gets a file with the same name already present in the directory but different md5 hash. Here yyyymmdd-HHMM is what he was referring to as xyz or abc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iswiftshek ideally the file name should be kept the same as it was on user's iPhone. Is there no way to get the original filename on the device?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that should be done. But the last time I looked into this, I couldn't find a way around it. But to the best of what I remember there was one method but it was deprecated.
I'll look into it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find a way to get the file name for images and videos picked from UIPickerViewController.
However, in case of documents, we get the file name directly from the url.
Added the upload feature. The user can either take a new photo with camera or upload from the gallery.