How to upload a CSV file in FastAPI and convert it into JSON?

Below are given various options on how to convert the uploaded .csv file into JSON. The following .csv sample file is used in the examples below. data.csv Id,name,age,height,weight 1,Alice,20,62,120.6 2,Freddie,21,74,190.6 3,Bob,17,68,120.0 Option 1 The csv.DictReader() method can accept as a file argument file objects as well. FastAPI’s UploadFile uses Python’s SpooledTemporaryFile, a file-like object (for … Read more

HTML Form File Uploads doesn’t upload file

you forgot to mention the enctype=”multipart/form-data” <form action=”upload_handler.php” enctype=”multipart/form-data” method=”post”> Select image to upload: <input type=”file” name=”fileToUpload” id=”fileToUpload”> <input type=”submit” value=”Upload” name=”submit”> </form>

Fix iOS picture orientation after upload PHP

Use exif_read_data to find out the orientation of the image: $exif = exif_read_data(‘image.jpg’); if (isset($exif[‘Orientation’])) { switch ($exif[‘Orientation’]) { case 3: // Need to rotate 180 deg break; case 6: // Need to rotate 90 deg clockwise break; case 8: // Need to rotate 90 deg counter clockwise break; } } You’ll find an explanation … Read more

iOS: Perform upload task while app is in background

You can continue uploads in the background with a “background session”. The basic process of creating a background URLSessionConfiguration with background(withIdentifier:) is outlined in Downloading Files in the Background. That document focuses on downloads, but the same basic process works for upload tasks, too. Note: you have to use the delegate-based URLSession; you cannot use … Read more