Bagisto Forum

    Bagisto

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

    Document not uploading

    General Discussion
    3
    5
    377
    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.
    • P
      ppstech last edited by ppstech

      Hello,
      I am trying to upload the files on the location "public\storage\new_documents\type_one", but my documents are not saved in public folder.
      I have checked the post request, getting all the data including the file data. Also added enctype='multipart/form-data' in the form.

      1 Reply Last reply Reply Quote 0
      • R
        rahul last edited by

        Hi @ppstech

        Can you show your code of uploading files ?

        Thanks

        1 Reply Last reply Reply Quote 0
        • P
          ppstech last edited by ppstech

          This is my code

          if($request->hasfile('crdocument')) {
                      $filenameWithExt = $request->file('crdocument')->getClientOriginalName();
                      //get file name
                      $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
                      //get extension
                      $extenson = $request->file('crdocument')->getClientOriginalExtension();
                      // filename to store
                      $fileimagetostore = $filename.'_'.time().'.'.$extenson;
                      //upload the image
                      $criddoc_path = $request->file('crdocument')->storeAs('public/new_documents/type_one',$fileimagetostore);
                  }else{
                      $fileimagetostore = "Nodoc.jpg";
                  }
          
          1 Reply Last reply Reply Quote 0
          • R
            rahul last edited by

            Hi @ppstech

            Try this one -

            if (request()->hasfile('file')) {
                 $filenameWithExt = request()->file('file')->getClientOriginalName();
            
                 //get file name
                 $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
            
                 //get extension
                 $extenson = request()->file('file')->getClientOriginalExtension();
                      
                 // filename to store
                 $fileimagetostore = $filename.'_'.time().'.'.$extenson;
            
                //upload the image
                 $criddoc_path = request()->file('file')->storeAs('public/new_documents/type_one',$fileimagetostore);
              } else{
                    $fileimagetostore = "Nodoc.jpg";
            }
            

            Thanks

            1 Reply Last reply Reply Quote 2
            • J
              Jaggu431 last edited by

              Best Trading Platform Online

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