zip

Read a zip file sent to a flask server without storing it on disk

情到浓时终转凉″ 提交于 2020-08-10 18:05:06
问题 I would like to read all the files in a zip file of a specific type sent to a flask server via a form post request without having to store the zip file on disk. 回答1: First, get the code to get the zip file from flask import Flask, request app = Flask(__name__) @app.route("/",methods=["GET"]) def page_name_get(): return """<form action="." method="post" enctype=multipart/form-data> <input type="file" accept="application/zip" name="data_zip_file" accept="application/zip" required> <button type=

Read a zip file sent to a flask server without storing it on disk

喜夏-厌秋 提交于 2020-08-10 18:04:24
问题 I would like to read all the files in a zip file of a specific type sent to a flask server via a form post request without having to store the zip file on disk. 回答1: First, get the code to get the zip file from flask import Flask, request app = Flask(__name__) @app.route("/",methods=["GET"]) def page_name_get(): return """<form action="." method="post" enctype=multipart/form-data> <input type="file" accept="application/zip" name="data_zip_file" accept="application/zip" required> <button type=

Exception when create zipFile in Android with Zip4j: Probably not a zip file or a corrupted zip file

蓝咒 提交于 2020-08-05 07:26:07
问题 I meet a problem when using zip4j library to generate zipfile in android, here's the code : try { ZipFile zipFile = new ZipFile(dest); zipFile.setFileNameCharset("GBK"); if (srcFile.isDirectory()) { zipFile.addFolder(srcFile, parameters); } else { zipFile.addFile(srcFile, parameters); } } catch (Exception e) { e.printStackTrace(); } and I got the Exception msg: net.lingala.zip4j.exception.ZipException: Probably not a zip file or a corrupted zip file at net.lingala.zip4j.core.HeaderReader

Exception when create zipFile in Android with Zip4j: Probably not a zip file or a corrupted zip file

你说的曾经没有我的故事 提交于 2020-08-05 07:25:10
问题 I meet a problem when using zip4j library to generate zipfile in android, here's the code : try { ZipFile zipFile = new ZipFile(dest); zipFile.setFileNameCharset("GBK"); if (srcFile.isDirectory()) { zipFile.addFolder(srcFile, parameters); } else { zipFile.addFile(srcFile, parameters); } } catch (Exception e) { e.printStackTrace(); } and I got the Exception msg: net.lingala.zip4j.exception.ZipException: Probably not a zip file or a corrupted zip file at net.lingala.zip4j.core.HeaderReader

Upload a ZIP file and UNZIP ftp folder via PHP

|▌冷眼眸甩不掉的悲伤 提交于 2020-08-03 09:09:09
问题 I want to make a form where you can fill FTP login server and get option to upload ZIP file. The script works apart from the last part (UNZIP the file) I want to perform UNZIP uploaded file. Does anyone know what is the problem? TIA <?php if (isset($_POST['Submit'])) { $ftp_server = $ftp = $_POST['ftp']; $ftp_user_name = $username = $_POST['username']; $ftp_user_pass = $password = $_POST['password']; if (!empty($_FILES['upload']['name'])) { $ch = curl_init(); $file1 = $localfile = $_FILES[

Compress a file into different parts in python

a 夏天 提交于 2020-07-31 03:20:49
问题 Is it a way in Python (2.7 preferably) to compress a file in several equally-sized .zip files?? The result would be something like: (lets assume 200MB selected and compressing a file of 1100MB) compressed_file.zip.001 (200MB) compressed_file.zip.002 (200MB) compressed_file.zip.003 (200MB) compressed_file.zip.004 (200MB) compressed_file.zip.005 (200MB) compressed_file.zip.006 (100MB) 回答1: I think you can do it in shell command. Somthing like gzip -c /path/to/your/large/file | split -b

Modify files inside zip file, other way

只愿长相守 提交于 2020-07-09 07:58:11
问题 I want to modify some files inside zip file. I tried using the class zip and it works: $zip = new ZipArchive; $res = $zip->open('test.zip'); if ($res === TRUE) { $zip->extractTo('./', 'test.txt'); $fp=fopen("test.txt","a"); fputs($fp,"Hello"."\n"); fclose($fp); $zip->addFile('test.txt'); $zip->close(); unlink ("test.txt"); } Is it possible to not create temp file for modify, extract, repack, etc. Instead, only modify inside of zip file the target file I want change. If it is not possible with

How to download zip file from server in Swift?

非 Y 不嫁゛ 提交于 2020-07-08 11:34:50
问题 I am trying to download zip file from server and unzip the file to get its content in Swift . Does the normal way of NSURLSession work? Any advices for me? Thanks! 回答1: I think that the question is a little broad, so consider this as a short and generic answer. First: You will need to download the archived file -you might want to use this method-. After downloading the file, you should save it in a directory -let's say documents -. Check this answer to know how you can achive those steps.

Overwrite contents of ZipArchiveEntry

谁都会走 提交于 2020-07-05 09:18:11
问题 How can I overwrite contents of a ZipArchiveEntry ? Following code using StreamWriter with StringBuilder fails if the new file contents are shorter than the original ones, for example: using System.IO.Compression; //... using (var archive = ZipFile.Open("Test.zip", ZipArchiveMode.Update)) { StringBuilder document; var entry = archive.GetEntry("foo.txt");//entry contents "foobar123" using (StreamReader reader = new StreamReader(entry.Open())) { document = new StringBuilder(reader.ReadToEnd());

Overwrite contents of ZipArchiveEntry

…衆ロ難τιáo~ 提交于 2020-07-05 09:18:00
问题 How can I overwrite contents of a ZipArchiveEntry ? Following code using StreamWriter with StringBuilder fails if the new file contents are shorter than the original ones, for example: using System.IO.Compression; //... using (var archive = ZipFile.Open("Test.zip", ZipArchiveMode.Update)) { StringBuilder document; var entry = archive.GetEntry("foo.txt");//entry contents "foobar123" using (StreamReader reader = new StreamReader(entry.Open())) { document = new StringBuilder(reader.ReadToEnd());