Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
How change the image name and save it, when i uploading an image to s3 using boto3

How change the image name and save it, when i uploading an image to s3 using boto3.

ex) datetime.jpg

pleas help....

@app.route('/fileupload', methods=['POST'])
def file_upload():
    file = request.files['file']
    s3 = boto3.client('s3',
                      aws_access_key_id="mykey",
                      aws_secret_access_key="myaccesskey"
                      )
    s3.put_object(
        ACL="public-read",
        Bucket="burket",
        Body=file,
        Key=file.filename,
        ContentType=file.content_type)
    print(url)
    return jsonify({'result': 'success'})
function save() {
    let form_data = new FormData($('#upload-file')[0]);
    $.ajax({
        type: 'POST',
        url: '/fileupload',
        data: form_data,
        processData: false,
        contentType: false,
        success: function (data) {
            alert("success!");
        },
    });
}

I think we can use this code. But it couldn't be used.

extension = file.filename.split('.')[-1]
today = datetime.now()
mytime = today.strftime('%Y-%m-%d-%H-%M-%S')

filename = f'file-{mytime}'

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can rename objects after uploading into s3.

client.copy_object(Bucket="BucketName", CopySource="BucketName/OriginalName", Key="NewName")
client.delete_object(Bucket="BucketName", Key="OriginalName")
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!