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

182
Views
read file with php that sent by axios with content-type : image/jpeg

hi i create a simple program when input type file change, file upload to the server and get it by php but in php server doesn't return any data and $_FILES is empty

my form content type is image jpeg and shoudn't change

and request type is put

and never use formdata

here my code:

 document.getElementById('filexxx').addEventListener('change',function(e){
        var formdata = new FormData();

        window.temp = e.target.files[0];
        console.log(e.target.files[0]);
        //https://divar.ir/upload_s3/temp/xxx.jpg
        axios.put('http://localhost:8080/test.php', e.target.files[0], {
                    withToken: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiMDkzNzUyMTA4NTciLCJleHAiOjE2MzY4Nzk1MDcuMDY3MTI2LCJ2ZXJpZmllZF90aW1lIjoxNjM1NTgzNTA3LjA2NzEzMSwidXNlci10eXBlIjoicGVyc29uYWwiLCJ1c2VyLXR5cGUtZmEiOiJcdTA2N2VcdTA2NDZcdTA2NDQgXHUwNjM0XHUwNjJlXHUwNjM1XHUwNmNjIn0.P0sfbX9pg_jOpX2zhf2H5YmIrBdXo-7NSq2ayaJIoQo',
                    headers: {
                        "Content-Type": "image/jpeg"
                    },
                    timeout: null
                })
    });

and my server side code in test.php

<?php
  var_dump($_REQUEST);
  var_dump($_FILES);
about 4 years ago · Juan Pablo Isaza
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!