I have a model with multiple files that when I get an object from it I want to be able to download all its related files from one click on anchor as a zip file
Related
I want to download folder and export as zip like we do in google drive. is there is anyway we can do in python requests. is there any endpoint for that?
downloadURL=x["#microsoft.graph.downloadUrl"]
print " download Url : ",downloadURL
I am using this https://graph.microsoft.com/v1.0/users/{user-id}/drive/root:/testing 1/new-file-name.docx. for getting that URL. how can I achieve same for folder.
As per the documentation Only driveItems with the file property can be downloaded. Folders don't have the property. I also don't get how a folder would need to be exported as pdf. I suggest you review your use case and find the files that you need to export to pdf instead of targeting folders.
I'm creating a website where the user is able to upload large files. Around 100-300Mb. I'm using django but I want to know what is the best option to save the files. Should I just add them to my user database? Or should I create a media folder and save the files there. If so then this would mean that I have to save the name of the file in my user database?
Please let me know how you would tackle this issue.
django does not store files in the database, but in media folder. The FileField contains the path to the file(in the media folder). You can change that behavior but it is not recommended(as general practice). What you should consider however is that files of that size will require some more work both in django and the front-end since the upload process will freeze the server. A potential solution to the problem is this: https://pypi.org/project/django-chunked-upload/
I have created an API in Django. It is supposed to take a request and pass the argument to allenNLP files to gather a computed response. I want to know how to run my django app in allenNLP environment and I want all the source code of allenNLP to be in a folder in my django project. Is it possible and how can I do it?
What you're looking for is running AllenNLP inside django.
You can add AllenNLP libraries in your requirements.py. Next, the .py file can be stored in any of your source code hierarchy.
In your views.py, where you are getting request and extracting parameters, you can call the .py file which contains allennlp source code.
Not sure about what AllenNLP files you're talking about, if it's code files, they can go in your regular source code folder, if it's a static files, like Image, CSV etc, they need to go in static folder.
Please clar my understanding of your requirement if the answer doesn't address your question.
I use fileInput to upload one file which contains the paths and file names of multiple files on my local computer.
I would then like to use these file paths and upload them to the server directly without the user having to perform any more interaction.
So simply put how do I upload a file to the shiny server I already know its local path?
I want users to upload their themes containing .css, .js files to my server in zip format, Once they will upload the application will unzip it and the user will be able to see the theme at mysite.com/themes/user/. I want to know what security issues can occur if I allow user to upload .css and js files to my server. Can the malicious code redirect the site or do DOS service attack or change the dynamic aspects on my site. Scanning the files for malicious code before unzipping seems impractical. What safeguards should I take.
First and foremost, don't unzip them into a public "temp" folder while you're doing whatever else you're going to do with them.
There's no telling what that ZIP file will actually contain.
There's no telling what those JS files will try to do to your site.
You should read what Samy did to MySpace before you implement this functionality. (A breakdown of the attack.)