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 8866857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:53:16+00:00 2026-06-14T16:53:16+00:00

Okay im using a snippet I found on google to take a users uploaded

  • 0

Okay im using a snippet I found on google to take a users uploaded image and put it in my directory under Content

But Im worried about duplicates so I was going have it upload the image as a Random number

well here is my code you can probably understand what im going for through it anyways

<label for="file">Profile Pic:</label> <input type="file" name="ProfilePic" id="ProfilePic" /><br />

<input type="submit" name="submit" value="Submit" />

$ProfilePicName = $_FILES["ProfilePic"]["name"];
$ProfilePicType = $_FILES["ProfilePic"]["type"];
$ProfilePicSize = $_FILES["ProfilePic"]["size"];
$ProfilePicTemp = $_FILES["ProfilePic"]["tmp_name"];
$ProfilePicError = $_FILES["ProfilePic"]["error"];

$RandomAccountNumber = mt_rand(1, 99999);  
echo $RandomAccountNumber; 
move_uploaded_file($ProfilePicTemp, "Content/".$RandomAccountNumber.$ProfilePicType);

And then basicly after all this Im going try to get it to put that random number in my database

Someone gave me a new snippet that looks like it will do what I want but now the file isnt making it all the way to my directory

$RandomAccountNumber = uniqid();
echo $RandomAccountNumber;

move_uploaded_file($ProfilePicName,"Content/".$RandomAccountNumber);
  • 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-14T16:53:17+00:00Added an answer on June 14, 2026 at 4:53 pm

    try using the php uniqid method to generate the unique id you need

    http://php.net/manual/en/function.uniqid.php

    $RandomAccountNumber = uniqid();
    move_uploaded_file($ProfilePicTemp, "Content/" . $RandomAccountNumber);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so I figured out the whole color business using HTML, but now when
Okay, I am using a custom tab bar (not a tab based app) but
Okay so using the inspector in safari I've found out that all chat messages
Okay I am creating a Table View using objective c, but the data source
Okay so I'm using Mosaic (a jQuery plugin for hover text, etc.) Anyways, I've
Okay so I'm not using any session variables, rather my code looks like this:
Okay so I am using MVCContrib TestHelper to unit test my controllers, which works
Okay; using the Umbraco CMS I have a xslt menu being generated in the
Okay So heres the issue, using an api (lyris hq) i am being returned
Is okay to break all dependencies using interfaces just to make a class testable?

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.