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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:36:31+00:00 2026-06-15T15:36:31+00:00

I already looked at this StackOverflow question and it didn’t help (similarly titled). I’m

  • 0

I already looked at this StackOverflow question and it didn’t help (similarly titled).

I’m passing an image in from my Android application. If I type

$file = fopen('test.jpg', 'wb');

It works correctly and the image uploads; however, I want to allow for multiple uploads from android phones, so I want to randomize the name of the .jpg file so that I can save each new upload as a different name. I was trying this below:

$destination =  time() + rand(1, 1000) . ".jpg";
$url_destination = "/project_images/" . $destination;

$file = fopen($url_destination, 'wb');
fwrite($file, $binary);
fclose($file);

It doesn’t write the file to the server, however. I tried different variations of the URL there – with ‘project_images/’, ‘/project_images/’, even trying the full URL (which the aforementioned StackOverflow post corrected me on), and I still can’t get it to write.

The permissions of the project_images folder are set to allow files to be written to it. Any ideas?

  • 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-15T15:36:33+00:00Added an answer on June 15, 2026 at 3:36 pm

    Your problem is "/project_images" which is a wrong absolute path.

    For it to work change it to "project_images/" or dirname(__FILE__).'/project_images/'.

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

Sidebar

Related Questions

Before I posted this question, I already looked this , but I couldn't get
I have already looked at this question but there was no solution. Here is
Sorry if this question has already been answered elsewhere. I looked through stack overflow
I've already looked at this question on representing strings in Python but my question
I've already looked at this question: Python iterators – how to dynamically assign self.next
I've looked through the various questions already asked on this topic, and I've spent
I already looked at a similar question here : null pointer exception-parsing json with
I've looked at a number of answers already on stackoverflow, but none of the
Quick question (and sorry if it's already been asked, I have looked but couldn't
Apologies if this has already been mentioned or answered but I have looked for

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.