Well, there was a form with some other things there to but the
$filadapter-object was initialized with:
$filadapter = new Zend_File_Transfer_Adapter_Http();
and that it gave the line 102 may depend on that I tried to change
some of the code but I've changed that back again
and line 102 is
if (!move_uploaded_file($content['tmp_name'], ($directory .
$content['name']))) {
and I use 1.7.1
And I meant Zend_Validate_File_Upload when I spoke of Upload earlier
If there is a way to configure Zend_File_Transfer_Adapter_Http() that
would help me out with this would of course be great
All my best
/Bertil
2009/1/23 Thomas Weidner <[email protected]>:
> The code you gave is only partitial... it is not visible how the adapter is
> initiated and configured.
> Also line 102 you gave is actually a comment.
>
> So I expect that you are using an outdated release.
> First update to the actual release.
>
> Second as soon as you call any method which sets or gets the destination
> directory it is checked it there is write permission.
> This is also done for the temporary directory when you don't set anyone.
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> ----- Original Message ----- From: "Bertil Wergelius"
> <[email protected]>
> To: "Thomas Weidner" <[email protected]>
> Cc: <[email protected]>
> Sent: Friday, January 23, 2009 2:19 PM
> Subject: Re: [fw-general] File_Transfer move_uploade_file permision denied
>
>
>> Yes, Thomas, I did look at the manual but I have this test-code (that
>> by the way works excellently with the filter to change the name of the
>> file to underscores instead of spaces all thanks to your code, that is
>> really great and I thank you for that):
>>
>> if ($form->isValid($_POST)) {
>> $filsokvag = $filuppladdning->getFilename();
>> $filnamnsfilter = new Zend_Filter_BaseName();
>> $sokvagsfilter = new Zend_Filter_Dir();
>> $mellanslag2understreck = new
>> Zend_Filter_Word_SeparatorToSeparator(' ','_');
>> $filnamnet = $filnamnsfilter->filter($filsokvag);
>> $sokvagen = $sokvagsfilter->filter($filsokvag);
>> $gammalsokvag = $sokvagen ."/".$filnamnet;
>> $nya_filnamnet = $mellanslag2understreck->filter($filnamnet);
>>
>> $nyafilsokvag = $sokvagen ."/" .$nya_filnamnet;
>> $filadapter->addFilter('Rename',array(
>> 'source' => $gammalsokvag,
>> 'target' => $nyafilsokvag,
>> 'overwrite' => true
>> )
>> );
>> $filadapter->receive();
>> etc...
>>
>> But if I change the directory rights to only read I get the message:
>> Warning:
>> move_uploaded_file(/var/www/Testa_Div_Zend_framework/div_dokument/testa.odt)
>> [function.move-uploaded-file]: failed to open stream: Permission
>> denied in
>> /var/www/ZendFramework/library/Zend/File/Transfer/Adapter/Http.php
>> on line 102
>>
>> I've tried to do all sorts of things with if (!$filadapter->receive()
>> etc but nothing works. It seems like it accepts $filadapter->receive()
>> as true although it can't move the file from tmp to the destination.
>>
>> Would be really grateful for help with sorting this out.
>>
>>
>> 2009/1/23 Thomas Weidner <[email protected]>:
>>>
>>> Bertil,
>>>
>>> Whatever you mean with upload but move_uploaded_file is part of PHP
>>> itself.
>>> It does handle invalid write permission.
>>>
>>> And also Zend_File_Transfer handles invalid write permissions and return
>>> an
>>> exception is this case with the proper message text.
>>> Have you tried it out or are you just looking at the code unable to find
>>> out
>>> how it works ? :-)
>>>
>>> Take a look at the manual or the examples which can be found around in
>>> the
>>> net.
>>>
>>> Greetings
>>> Thomas Weidner, I18N Team Leader, Zend Framework
>>> http://www.thomasweidner.com
>>>
>>>
>>> ----- Original Message ----- From: "Bertil Wergelius"
>>> <[email protected]>
>>> To: <[email protected]>
>>> Sent: Friday, January 23, 2009 12:03 PM
>>> Subject: [fw-general] File_Transfer move_uploade_file permision denied
>>>
>>>
>>>> Why doesn't Upload catch the possibility that the destination catalog
>>>> has no write privileges?
>>>> I used to have a class for image uploads with this code sample:
>>>> if ($fel==UPLOAD_ERR_OK) {
>>>> if (!($flytta_f...@move_uploaded_file($tempfil,$malet))) {
>>>> return("Flyttning av filen misslyckades");
>>>> } else {
>>>> etc
>>>> and that works fine. But I can't figure out how that would be done in
>>>> or with Zend_File_Transfer.
>>>
>>>
>
>