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

  • SEARCH
  • Home
  • 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 7868309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:57:35+00:00 2026-06-03T00:57:35+00:00

generatedReference will = abc (for example) nameWithExt = abc.txt But the file saved to

  • 0

generatedReference will = “abc” (for example)
nameWithExt = “abc.txt”

But the file saved to the filesystem will end up being:
abc501883476493193605.txt

Where those numbers seem to be randomly generated by smoething? Anyone konw whats going on?

File directory = new File(bc.getUploadDirectoryPath(dir)); //c:/temp
            String generatedReference = CreateUniqueFileReference();
            String nameWithExt = generatedReference + "." + GetExtensionOfFile(fb.getFileName());
            //File f = File.createTempFile(generatedReference, "." + GetExtensionOfFile(fb.getFileName()), directory);
            //File f = File.createTempFile("abc","myExt", directory); STILL GENERATED RANDOM NOS in file?
            fb.save(f);
            bc.getLogger().info("TrySaveFile: "+nameWithExt);

public static String CreateUniqueFileReference() {
        java.util.Date today = new java.util.Date();
        String d = new java.text.SimpleDateFormat("ddMMyyyyHHmmss").format(new java.sql.Timestamp(today.getTime()));
        Random r = new Random();
        String randomNum =  Integer.toString(r.nextInt(10000) + 0);
        return d + "_" + randomNum;
    }
  • 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-03T00:57:36+00:00Added an answer on June 3, 2026 at 12:57 am

    The CreateUniqueFileReference generates those numbers. It’s right there in the code.

    Sorry, was wrong, but it looks like it’s the output from File.createTempFile(), that typically generates a long string of numbers after the name to make it unique.

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

Sidebar

Related Questions

I am creating a service reference to a WCF service using VS2008 but the
I have ported over some code from a Windows application to Monotouch. It is
The ultimate goal is to specify contracts for a class that resides in an
The application I am developing is exposing service metadata for a WCF service implementing
I have 3 projects in the same solution - one exposes a WCF service
I have an internal enterprise app that currently consumes 10 different web services. They're
So, we're processing credit card payments, and each payment needs a unique reference ID.
I'm getting a build error in Visual Studio that's not making any sense: The
Consider the following Visual Studio project structure ProjectA.csproj AClass.cs ProjectB.csproj References ProjectA Web References
I'm writing a middle-tier WCF service that needs to fetch some data from a

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.