Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using fputs and flushing the server

Status
Not open for further replies.

someoneneedshelps

Technical User
Mar 3, 2016
75
GB
I'm using the method below to copy an image from one directory to another on the fly, the thing is, when I use the move_uploaded_file method it doesn't see the image...

I have to click refresh on the server then the image appears in the FROM directory but the move method must not be able to see it? any help please?

Code:
		$doc_root= $_SERVER['DOCUMENT_ROOT'];		
		$image_upload_path = $doc_root . '/imagedump/';		
		$image_name = 'img-' . time() . '.jpg';

		$destination  = $image_upload_path . $image_name;	
		$data = file_get_contents($imgstr);
		$file = fopen($destination, "w+");
		fputs($file, $data);		
		fclose($file);

this is the move file method,

Code:
move_uploaded_file($destinationfrom, $upload_path . $auction_id . '/' . $image, false);

the directory is also made on the fly but that does appear

Code:
mkdir($upload_path . $auction_id, 0777);
 
have you tested '$destinationfrom to make sure it does return a valid path?


because your code defines $destination but not $destinationfrom

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Well, it could of been but ive moved on file_put_contents method and i have it working if anyone wantsbto see it[highlight #FCE94F][/highlight]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top