Kevin Bosak <[EMAIL PROTECTED]> writes:

> Thanks again for the help but still no luck.
> I set the TMPDIR environment variable manually and restarted apache
> but still can't get the upload file in my script and nothing's being
> written to the tmpdir.  If there's anything else I can try please let
> me know but I may just end up having to use CGI.pm for uploads.

Try replacing the apreq_xs_upload_link() function in 

  glue/perl/xsbuilder/Apache/Request/Apache__Request.h

with the following one; rebuild and install it.  If this 
doesn't solve your problem, the next release should include more
helpful diagnostics, but until then CGI.pm is always available.


APR_INLINE
static XS(apreq_xs_upload_link)
{
    dXSARGS;
    MAGIC *mg;
    void *env;
    const char *name, *fname;
    apr_bucket_brigade *bb;
    apr_file_t *f;

    if (items != 2 || !SvROK(ST(0)))
        Perl_croak(aTHX_ "Usage: $upload->link($name)");

    if (!(mg = mg_find(SvRV(ST(0)), PERL_MAGIC_ext)))
        Perl_croak(aTHX_ "$upload->link($name): can't find env");

    env = mg->mg_ptr;
    bb = apreq_xs_rv2param(ST(0))->bb;
    name = SvPV_nolen(ST(1));

    f = apreq_brigade_spoolfile(bb);
    if (f == NULL) {
        apr_off_t len;
        apr_status_t s;
        const apr_int32_t flags = APR_CREATE | APR_EXCL | APR_WRITE |
            APR_READ | APR_BINARY | APR_BUFFERED;

        s = apr_file_open(&f, name, flags,
                          APR_OS_DEFAULT,
                          apreq_env_pool(env));
        if (s != APR_SUCCESS || 
            apreq_brigade_fwrite(f, &len, bb) != APR_SUCCESS)
            XSRETURN_UNDEF;
    
        XSRETURN_YES;
    }
    if (apr_file_name_get(&fname, f) != APR_SUCCESS)
        XSRETURN_UNDEF;

    if (PerlLIO_link(fname, name) >= 0)
        XSRETURN_YES;
    else {
        apr_status_t s = apr_file_copy(fname, name,
                                       APR_OS_DEFAULT, 
                                       apreq_env_pool(env));
        if (s == APR_SUCCESS)
            XSRETURN_YES;
    }

    XSRETURN_UNDEF;
}

-- 
Joe Schaefer


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to