Bulk upload image files in Zip-Archive

Hello,
It would be very helpful if it was possible to upload several files/images within a Zip-Archive. Especially if direct access to the filesystem is not possible (hosted erpnext installation). It would make deployment/setup of a new ERPNext installation much easier. It would be even better, if the paths in the Zip-Archive would also be mapped in the hierarchy of the ERPNext /files/ directory. The bulk import of the images with csv-files through frappe would be much easier, if the images/files could also be uploaded in a Zip-Archive within frappe.
I looked at the documentation and as far as I can see there is no way to upload an image/file through the web-api. Is this correct?
Thanks.

1 Like

@jerome76 It’s impossible to overestimate the usefulness of bulk image upload feature. We have just started using ERPNext and we have hundreds of images to import, so we’d definitely benefit with bulk upload.
In case that there’s an efficient way to implement the feature, is there a possibility to accelerate development financially?

Regards.

@strixaluco @jerome76

There are many ssh/ftp like filezilla/putty, using this you can easily do bulk upload and restore of ERPNext.

Also, where you do not have access to file system, How you restore database?
You need to give your database file and zip file of all files to hosting provider and they should import all files for you(If they are not giving file access to you)

Would you be so kind to share a link to the guide or describe how to make bulk image upload in ERPNext SaaS, please?
Thanks.

@strixaluco Bulk Upload is very good feature if you are referring to end user.
But if you are referring to developer, then you can use this two option.

  1. Use FileZilla.
    You can connect to server using FileZila, then transferring files or folders is just a matter of Drag & Drop
    Please see image.

  2. If you are restoring ERPNext from one server to another, then you can directly do copy past from one server to another.
    It will give very fast copy past speed, because you are doing server to server copy past.
    You can use scp -r < from folder> <linuxusername@linux server ip>:<"path to folder>

e.g Using below command I am coping files into files folder of site1.local.
All files is copied into erp@sbkolate.com server.(It will gives 140mbps speed :smiley: )

sbkerp@vm9850015051:~/frappe-bench/sites/site1.local/public$ scp -r files/ erp@sbkolate.com:"/home/erp/frappe-bench/sites/sbk.local/public/files"
1 Like

@kolate_sambhaji, but what about metainformation for files from database?

@alex_melkoff when you restore database, file information also comes in database.

You can also use data import tool to to import file information in bulk.

Thank you for elaborating, @kolate_sambhaji. For sure uploading via SFTP/SSH would already help a lot, I didn’t realize it’s possible with ERPNext SaaS

1 Like

@kolate_sambhaji, ok, but what if I am creating new instance from scratch? Imagine I have a lot of images (~100 or even ~1000) and I want to upload them to ERPNext. If I’ll use scp to upload them directly into files directory but that won’t create metadata for files (doctype File). What is the fastest way to upload a lot of files properly?

1 Like

We are looking into this. From an end-user point of view it would probably make sense to be able to upload zip-files through frappe.
The “File Manager”-Menu could provide an option “Import Zip-Archive” for this. Metadata for the files should be imported through existing “Data Import Tool” File.csv upload functionality. With this option end users would be able to upload multiple images in one zip-file.

Advanced file upload (delete, merge, replace etc.) should definitely be done with scp/ftp.

1 Like

Hello, Jerome. So you want to be able to upload zip-file with images via File Manager. This zip-file after upload should be extracted to the /private/files folder. And for all files from this zip-archive should be created docs “File” and “Communication”. Does it what you want?

1 Like

Hello, Jerome. Bulk uploading according to your requirements implemented in https://github.com/semilimes/frappe/tree/bulk_upload

2 Likes

Super! Thank you for your contribution, @osya. Are you going to pull request upstream?

As a follow up — I have just received reply from official support, in which it’s said that ERPNext cannot offer SFTP/SSH login to hosted clients because other accounts are hosted at the same server.

@kolate_sambhaji, how do you make bulk upload as a hosted client?

@strixaluco You can ask them to upload files for you when you are sending first time db restore request.

@kolate_sambhaji Unfortunately, the reply from official support stated that they can’t upload files for me. @osya @rmehta, is there something I can help with to make the bulk image upload patch got merged to upstream?
Thank you.

Pull request created: Bulk upload image files in zip-archive by osya · Pull Request #1664 · frappe/frappe · GitHub

1 Like

Thank you, @osya.
Travis is showing that test_link_count didn’t pass.

@jerome76, @rmehta said that File records should be created for the un-zipped files (Bulk upload image files in zip-archive by osya · Pull Request #1664 · frappe/frappe · GitHub). Could you discuss it with @rmehta and make a decision? Thanks

I recommend not adding File records. This can and should be done by csv-file-import. In case of Thumbnails, there is no direct file record and because of this it is better to add the file records separately through csv-file-import.
e.g.

DocType:    File 
Column Labels:    ID File Name    Is Private    File Size   File URL           Thumbnail URL              Is Folder    Attached To  
-                    200001.png   0             0           /files/200001.png  /files/200001-small.png    0            Item    200001