Error when uploading image using Amazon S3

0 votes

I am getting an error when i try to upload an image using S3. Here's the code:

$uploaddir = 'images/';
$file = basename($_FILES['userfile']['name']);
$uploadfile = $uploaddir . $file;

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "Data Uploaded Successfully";
} else {
    echo "ERROR";

But it gives this error:

<?xml version="1.0" encoding="UTF-8" ?>
    <Message>The specified method is not allowed against this resource.</Message>

What do i do?

Mar 25, 2019 in AWS by datageek
• 3,050 points

1 answer to this question.

0 votes

You are using the php's default method POST to submit the data. Most web applications differentiate between the verbs GETPUT and POST. 

Take a look at PHP libraries. 

answered Mar 25, 2019 by Archana
• 5,600 points

Related Questions In AWS

0 votes
1 answer

AWS Access Key error when uploading to S3

You can try getting creating a new ...READ MORE

answered Feb 6, 2019 in AWS by Priyaj
• 57,530 points
+1 vote
1 answer

Invalid hostname error when connecting to S3 using secret key

Hey, it works perfectly fine you just ...READ MORE

answered Oct 11, 2018 in AWS by Archana
• 4,150 points
+1 vote
2 answers
0 votes
1 answer

AWS S3 uploading hidden files by default

versioning is enabled in your bucket.….... the ...READ MORE

answered Oct 4, 2018 in AWS by Priyaj
• 57,530 points
0 votes
1 answer

How to decrypt the encrypted S3 file using aws-encryption-cli --decrypt

Use command : aws s3 presign s3://mybucket/abc_count.png you get ...READ MORE

answered Oct 22, 2018 in AWS by Priyaj
• 57,530 points
0 votes
1 answer

Import my AWS credentials using python script

Using AWS Cli  Configure your IAM user then ...READ MORE

answered Nov 16, 2018 in AWS by Jino
• 5,660 points
–1 vote
1 answer

How to read a csv file stored in Amazon S3 using csv.DictReader

The code would be something like this: import ...READ MORE

answered Oct 25, 2018 in AWS by Archana
• 5,600 points
0 votes
1 answer

Using Amazon S3 for the photo storage

Pre-generating different sizes and storing them in ...READ MORE

answered Oct 26, 2018 in AWS by Archana
• 5,600 points