Jump to content

File Upload Problem


Perad

Recommended Posts

I have changed getcwd(); to get_option('port_url') in an attempt to make this a little more dynamic. However I am now getting errors.

 

Could someone help to tell me what is going wrong.

 

Error:

Warning: move_uploaded_file(http://localhost/wordpress/portfolio/Photo1.jpg) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in /Applications/xampp/xamppfiles/htdocs/wordpress/wp-content/plugins/js_portfolio.php on line 93

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpjF23Ia' to 'http://localhost/wordpress/portfolio/Photo1.jpg' in /Applications/xampp/xamppfiles/htdocs/wordpress/wp-content/plugins/js_portfolio.php on line 93

There was an error uploading the small image, please try again!

Warning: move_uploaded_file(http://localhost/wordpress/portfolio/Photo1.jpgPhoto1.jpg) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in /Applications/xampp/xamppfiles/htdocs/wordpress/wp-content/plugins/js_portfolio.php on line 100

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpQyrKVx' to 'http://localhost/wordpress/portfolio/Photo1.jpgPhoto1.jpg' in /Applications/xampp/xamppfiles/htdocs/wordpress/wp-content/plugins/js_portfolio.php on line 100

There was an error uploading the large image, please try again!

 

 

get_option('port_url') = http://localhost/wordpress/portfolio/

 

PHP

 

$target_path = get_option('port_url');

	if(!file_exists($target_path))
	{					
		mkdir($target_path);					
	}

	/* Add the original filename to our target path.  
	Result is "uploads/filename.extension" */
	$target_path = $target_path . basename($_FILES['port_spic']['name']);
	if(move_uploaded_file($_FILES['port_spic']['tmp_name'], $target_path)) {
		$smallimage = $_FILES['port_spic']['name'];
	} else{
		print "There was an error uploading the small image, please try again!";
	}

	$target_path = $target_path . basename($_FILES['port_lpic']['name']);
	if(move_uploaded_file($_FILES['port_lpic']['tmp_name'], $target_path)) {
		$largeimage = $_FILES['port_lpic']['name'];
	} else{
		print "There was an error uploading the large image, please try again!";
	}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.