Bhavin Turakhia wrote:
> One more bit of information however if it helps you help me. The attachment
> entry goes into mysql. But if i go into the blobs directory where the file
> should be uploaded there is a file created with the long name as stated in
> the database however its filesize is zero.
Then the actual attachment creation is OK.
> could there be any issue in the file upload component of midgard-php....
If there is it should also be in plain PHP. Could you try the attached
patch?
It should offer more information on where the problem asserts itself.
Emile
--- midgard/php/midgard/mgd_attachment.c Thu Jan 18 09:20:26 2001
+++ ../mgd_attachment.c Fri Jan 19 10:25:53 2001
@@ -467,8 +467,13 @@
CHECK_MGD;
blobdir = mgd_get_blobdir(MGD_ENV.mgd);
- if (!blobdir || *blobdir != '/')
+ if (!blobdir || *blobdir != '/') {
+ ap_log_rerror(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO,
+ GLOBAL(php3_rqst),
+ "Midgard: Blob path %s not absolute",
+ blobdir ? blobdir : "<NULL>");
RETURN_FALSE_BECAUSE(MGD_ERR_INTERNAL);
+ }
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &pv_bid) != SUCCESS) {
WRONG_PARAM_COUNT;
@@ -521,6 +526,9 @@
if (!(fp = fopen(path, "r"))) {
mgd_free_pool(pool);
mgd_release(res);
+ ap_log_rerror(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO,
+ GLOBAL(php3_rqst),
+ "Midgard: Cannot open blob %s for reading", path);
RETURN_FALSE_BECAUSE(MGD_ERR_INTERNAL);
}
@@ -530,6 +538,9 @@
if (!php3_header()) {
mgd_free_pool(pool);
mgd_release(res);
+ ap_log_rerror(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO,
+ GLOBAL(php3_rqst),
+ "Midgard: Cannot send blob header (%s)", path);
RETURN_FALSE_BECAUSE(MGD_ERR_INTERNAL);
}
@@ -549,13 +560,22 @@
midgard_pool *pool;
char *path;
struct stat blobstat;
+ char *blobdir = NULL;
IDINIT;
CHECK_MGD;
- if (!MGD_ENV.dcfg || !MGD_ENV.dcfg->blobdir
- || *(MGD_ENV.dcfg->blobdir) != '/')
+ if (MGD_ENV.dcfg && MGD_ENV.dcfg->blobdir
+ && *(MGD_ENV.dcfg->blobdir) == '/')
+ blobdir = MGD_ENV.dcfg->blobdir;
+
+ if (!blobdir) {
+ ap_log_rerror(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO,
+ GLOBAL(php3_rqst),
+ "Midgard: Blob path %s not absolute",
+ blobdir ? blobdir : "<NULL>");
RETURN_FALSE_BECAUSE(MGD_ERR_INTERNAL);
+ }
res = mgd_sitegroup_record(MGD_ENV.mgd, "location", "blobs", id);
@@ -579,6 +599,9 @@
stat(path, &blobstat);
if (array_init(return_value) == FAILURE) {
+ ap_log_rerror(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO,
+ GLOBAL(php3_rqst),
+ "Midgard: failed to create stat array");
RETURN_FALSE_BECAUSE(MGD_ERR_INTERNAL);
}
add_next_index_long(return_value, blobstat.st_dev);
@@ -674,8 +697,13 @@
}
blobdir = mgd_get_blobdir(MGD_ENV.mgd);
- if (!blobdir || *blobdir != '/')
+ if (!blobdir || *blobdir != '/') {
+ ap_log_rerror(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO,
+ GLOBAL(php3_rqst),
+ "Midgard: Blob path %s not absolute",
+ blobdir ? blobdir : "<NULL>");
RETURN_FALSE_BECAUSE(MGD_ERR_INTERNAL);
+ }
res =
mgd_sitegroup_record(MGD_ENV.mgd, "ptable,pid,location", "blobs",
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]