Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8319349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:17:54+00:00 2026-06-08T22:17:54+00:00

//This is a sample file upload. it works fine in my localhost but it

  • 0

//This is a sample file upload. it works fine in my localhost but it didn’t work in intranet..
//This is my codes

<?php require_once "../session.php" ?>
<?php
$host='localhost'; // My hostname
$username='root'; // Mysql username
$password='*******'; // Mysql password
$db_name='jobs'; // DB name

// Connect to server and select database.
mysql_connect($host, $username, $password)or die("Cannot Connect");
mysql_select_db($db_name);

// Where the file is going to be placed 
$TARGET_PATH = "uploads/";
// Get our POSTed variables
$uploadedfile = $_FILES['uploadedfile'];
// Sanitize our inputs
$uploadedfile['name'] = mysql_real_escape_string($uploadedfile['name']);

// Build our target path full string.  This is where the file will be moved do
// i.e.  images/picture.jpg
$TARGET_PATH .= $uploadedfile['name'];

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if (move_uploaded_file($uploadedfile['tmp_name'], $TARGET_PATH))
{
    $sql = "update personal set resume='" . $uploadedfile['name'] . "' where username='".$_SESSION['name']."'";
    $result = mysql_query($sql) or die ("Could not insert data into DB: " . mysql_error());
    header("Location: ../scripts/view.php");
    exit;
}
else
    {
        echo "There was an error uploading the file, please try again!";
    }

?>

This only works in my pc (localhost using wamp). :((

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:17:55+00:00Added an answer on June 8, 2026 at 10:17 pm

    Make sure have appropriate permissions on uploads/ folder. Use Filezilla to configure that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to upload file via curl in php, this is my sample code
I have this simple script which works fine, but currently overwrites files with duplicate
Hi I am integrating the watermark code http://koivi.com/php-gd-image-watermark/ This script works well. But I
I have a sample.xhtml file which has few lines of javascript. This javascript will
I am trying to read this file I created as sample made up from
I have developed sample api as jar file. This jar file contains the code
I have these (sample) lines in a HTML-file: test.ABC.test test.ABCD.test test.ABCE.test And this Ant
I have a very simple file upload PHP script. I am testing with a
I am trying to upload file to a php server from my android device.
I am trying to implement a simple file upload, but having some troubles. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.