davBro 0 Newbie Poster

Hi, I haven't been on this community forum for quite a while. I have been getting an annoying problem with my file uploads (i.e. pdf documents), to my remote server.

The upload_file form was working great for a long time, but just recently it stopped working. The problem there, was, once I clicked on the 'submit' button to send the file to the 'remote uploads folder' nothing happened, not even an error message.

I then logged into the website cPanel Admin Page , then opened file manager to access the 'uploads' folder in 'backend' section, and proceeded to upload a file that way. As soon as I located the file to upload in the upload form of file manager and clicked on upload file, I noticed the upload was taking a longer time than usual to upload.

The progress bar was moving but the path name shownwas:- c:\fakepath*.pdf: 318.96 KB / 1.75 MB (17%) complete ETA ~ 0m 32s @ 45.07 KB/s. Once the file upload progress had completed I received the following message: C:\fakepath*.pdf: 1.43 MB complete.

I even tried 'Legacy File Manager' and the file upload without any messages. Permissions on the 'uploads' folder are correct.

This obviously I knew to be out of the ordinary, I'd never even seen 'c:\fakepath' problem before. I checked the uploads folder to see if the file had actually uploaded, it had. It's not the way I want the client to upload a file to the website, I want them to upload the file via the website 'admin' section but cannot do so because of notohing happening in the website upllaod form, and, I suspect the fakepath problem.

I have contacted the website host providers but they say the problem is that the upload process is looking for the c:\fakepath folder, to which I do not think so. It looks like the problem may be caused by 'c:\fakepath' ?.

I would like to know what does c:\fakepath mean, I don't understand this, never heard of it before. I would just like to fix this file upload problem, I don't think there is a problem from my end.

Can anyone help me please, Thank You.

Please find the example code for 'upload_file.php':

<?php 
    session_start();
    //Must go through login and be Admin    
    if(!$_SESSION['loggedIn']) {
        header('Location: index.php');
    }
    $title = 'Upload File'; 
    require_once('template/header.php');
    require_once('template/connect.php');
?><br /><br /><br /><br /> <div id="uploadFile"> <div id="uploadFiles"> <?php
                if (isset($_POST['submit'])) { // Check if the form has been submitted.
                    $target = "uploads/"; 
                    $target = $target . basename( $_FILES['uploaded']['name']) ; 
                    $ok=1; 

                    //This is our size condition 
                    if (@$uploaded_size >2950000){ 
                        echo "Your file is too large.<br>"; 
                        $ok=0; 
                    } 
                    //This is our limit file type condition 
                    if (@$uploaded_type =="text/php"){ 
                        echo "No PHP files<br>"; 
                        $ok=0; 
                    } 
                    //Here we check that $ok was not set to 0 by an error 
                    if ($ok==0){ 
                        echo "Sorry your file was not uploaded"; 
                    } 
                    //If everything is ok we try to upload it 
                    else { 
                        if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){ 
                        echo "              
                                                  
                              The file ". basename(@$_FILES['uploadedfile']['name']). " has been uploaded"; 
                        } 
                        // else { 
                        //    echo "Sorry, there was a problem uploading your file."; 
                        //} 
                    } 
                }
                ?> </div> <form enctype="multipart/form-data" action="upload_file.php" method="POST"> <fieldset> <legend> Upload File | <a href="viewFile.php" class="apageLinks">View File List</a> | 
                                                              <a href="menu.php" class="apageLinks">Main Menu</a> | 
                                                              <a href="logout.php" class="apageLinks">Log out</a> 
                        </legend><br /><br />
                        Please choose a file:<input name="uploaded" type="file" /><br /><br /> <input name="submit" type="submit" value="Submit" class="form" /><br /> </fieldset> </form><br /><br /><br /><br /><br /> </div> <!-- End of page content --> </div> </body> </html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.