Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Duplicated File #3

Open
ghost opened this issue Jun 29, 2016 · 3 comments
Open

Delete Duplicated File #3

ghost opened this issue Jun 29, 2016 · 3 comments

Comments

@ghost
Copy link

ghost commented Jun 29, 2016

HI.
I am using your plugin very well.
Very simple and good.
But I found some issues.
When uploading file, you made same number copy of .xlsx file as sheet number.
I am wondering why this happens.

And When delete the file in admin menu page, it only delete the file which name has no _sheet.
The other files remains.
It is same about the json files created from the *_sheet_i.xlsx.

@ghost
Copy link
Author

ghost commented Jun 29, 2016

And Is there any possibility to extend the file format ?
So we can upload .xlsx, cls, csv, etc.

@ghost
Copy link
Author

ghost commented Jun 29, 2016

Hi,
I found the reason.
I think this file should be fixed.

wp-excel-csm-admin.php : 287 line
foreach($options['sheet_names'] as $sheetId => $sheetName){
--------------->
foreach($options['sheet_names'] as $sheetId => $sheetName){

and
$res = @Unlink($this->upload_dir.'/'.$options['slug'].'sheet'.$sheetId.'.json');
$res = @Unlink($this->upload_dir.'/'.$options['slug'].'sheet'.$sheetId.'.xlsx');

@ghost
Copy link
Author

ghost commented Jun 29, 2016

If you want to generate only one .xlsx file for uploaded xlsx file:

wp-exccel-csm-admin.php:

public function createJsonDataFile($jsonData, $new_file_name ) {
...
if(!strpos($new_file_name, 'sheet'))
{
$file_ext = end( explode( ".", $_FILES["file"]['name'] ) );
$file_name = $this->upload_dir . '/' . $new_file_name . '.' . $file_ext;
$fp = fopen( $file_name, "wb" );
fwrite( $fp, file_get_contents( $_FILES["file"]["tmp_name"] ) );
fclose( $fp );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants