6 Replies - 453 Views - Last Post: 09 January 2013 - 09:36 AM Rate Topic: -----

#1 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Error:Move Uploaded File Failed To Open Stream: Is a Directory

Posted 08 January 2013 - 02:21 PM

I am trying to move and uploaded file from the temp folder and I keep getting Failed To Open Stream: Is a Directory. I have never seen this error before. Can anyone tell me why I am getting this error message? I have checked my permissions, and I do have permission to write to the folder. My permissions are 777. Any ideas? Thanks In Advance!

This post has been edited by BarNunBoi: 08 January 2013 - 02:23 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Error:Move Uploaded File Failed To Open Stream: Is a Directory

#2 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Re: Error:Move Uploaded File Failed To Open Stream: Is a Directory

Posted 08 January 2013 - 02:26 PM

Also why is my directory showing as follows : app/webroot//spreadsheet

Notice the 2 forward slashes

This post has been edited by BarNunBoi: 08 January 2013 - 08:23 PM

Was This Post Helpful? 0
  • +
  • -

#3 Anthonidas  Icon User is offline

  • D.I.C Head

Reputation: 30
  • View blog
  • Posts: 218
  • Joined: 25-April 11

Re: Error:Move Uploaded File Failed To Open Stream: Is a Directory

Posted 08 January 2013 - 03:06 PM

where is your code?
Was This Post Helpful? 0
  • +
  • -

#4 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Re: Error:Move Uploaded File Failed To Open Stream: Is a Directory

Posted 08 January 2013 - 03:52 PM

public function saveSpreadsheet($uploadedFile) {
		
		if(!empty($uploadedFile) && !empty($uploadedFile['tmp_name'])) {
			if($uploadedFile['error'] == UPLOAD_ERR_OK) {
				$pulledData = $this->extract($uploadedFile['tmp_name']);
				$filePath = WWW_ROOT . DS . 'spreadsheet';
					
				if(!empty($pulledData)){
					$pulledData = $this->Declination->ContactType->setSpreadsheetContactTypeIds($pulledData);
					if(!empty($pulledData[$this->alias])) {
						$this->save($pulledData[$this->alias]);
						unset($pulledData[$this->alias]);
						$coverageId = $this->id;
						$pulledData = $this->setSpreadsheetCoverageIds($pulledData, $coverageId);
						$pulledData = $this->CoverageInsured->setSpreadsheetCoverageInsuredIds($pulledData);
						//$pulledData = $this->Policy->Location->setupSpreadsheetPolicyLocation($pulledData, $coverageId);
					}
					$this->CoverageInsured->save($pulledData['CoverageInsured']);
					$this->Declination->saveAll($pulledData['Declination']);
					$this->savePolicyData($pulledData);
					move_uploaded_file($uploadedFile['tmp_name'], $filePath); 
					//$this->Policy->Location->saveAll($pulledData['Location']);
					//$this->Policy->Company->saveAll($pulledData['Policy']);
					return $coverageId;
				}
			}
		}
		
		return false;
	}

Was This Post Helpful? 0
  • +
  • -

#5 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Re: Error:Move Uploaded File Failed To Open Stream: Is a Directory

Posted 09 January 2013 - 08:10 AM

In addition to what I have already posted...when I go to the webroot folder and check write permissions for Group and World and run my script I get a Unknown Server Error. Hope this helps. With that said, my permissions for the spreadsheet folder is 777.
Was This Post Helpful? 0
  • +
  • -

#6 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Re: Error:Move Uploaded File Failed To Open Stream: Is a Directory

Posted 09 January 2013 - 08:52 AM

Ok here what I've got so far......I changed

 $filePath = WWW_ROOT . DS . 'spreadsheet';



to

 $filePath = WWW_ROOT . DS . $uploadedFile['name']';



and the file saved but it didn't save inside the spreadsheet folder..it saved in the webroot folder. So I am no longer getting an error message. I am just having trouble saving to the right folder. With that said my file structure is as follows:

app/webroot/spreadsheet

How would I write my file path so I can drill down into the spreadsheet folder?

This post has been edited by BarNunBoi: 09 January 2013 - 09:31 AM

Was This Post Helpful? 0
  • +
  • -

#7 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Re: Error:Move Uploaded File Failed To Open Stream: Is a Directory

Posted 09 January 2013 - 09:36 AM

Never mind!! I got it!! This is what I ended up with

$filePath = WWW_ROOT.'/spreadsheet/' . DS . $uploadedFile['name'] ;


Problem solved!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1