No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Get File, File Name and Additional Fields From Q-Uploader in Server Side

    Help
    file php q-uploader
    2
    2
    2139
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BrianMoreno last edited by

      Hi, so I’m having a bit of a problem when using Q Uploader. I’m trying to upload an image and send some additional data with the request to a PHP file, this is what I have:

      <q-uploader
      extensions=".png"
      method=“POST”
      name=“image”
      :additionalFields="[{‘data’: my_data_variable}]"
      float-label=“Actualizar Foto de Perfil”
      color=“dark”
      :url= “getRootURL + ‘app/upload-img’”
      style=“margin: 30px;”
      />

      I’m using PHP on my server side, which is where I want to perform the image upload, this is what I have:

      *$extension = mb_strtolower(end(explode(’.’, $_FILES[‘image’][‘name’]))); // trying to get image extension

      if($extension == “png”):
      if(move_uploaded_file($_FILES[‘image’][‘tmp_name’], “/images/folder/” . $_POST[‘data’] . “.png”)){
      echo “true”;
      }else{
      echo “false”;
      }
      endif;*

      However, this is giving me the following errors:

      [22-Sep-2017 21:19:39 America/Mexico_City] PHP Strict Standards: Only variables should be passed by reference in /my-site/upload_image.php on line 1
      [22-Sep-2017 21:19:39 America/Mexico_City] PHP Notice: Undefined index: data in /my-site/upload_image.php on line 4

      Anyone know why I’m getting these errors and how I can go about fixing them? What I want to do is get the value of the additional ‘data’ variable passed in from the and move the uploaded image to the images folder, I’m currently using $_FILES[‘image’][‘tmp_name’] to try to get the image and move it to the folder.

      1 Reply Last reply Reply Quote 0
      • A
        ACU last edited by

        try to do it as follows
        <q-uploader: url = “url”: headers = “headers”: additionalFields = “additionalFields”>

        additionalFields: [
                   {
                     name: ‘user_id’,
                     value: ‘1’
                   }
                 ]

        1 Reply Last reply Reply Quote 0
        • First post
          Last post